@@ -276,7 +276,7 @@ namespace Discord | |||||
/// <summary> Disconnects from the Discord server, canceling any pending requests. </summary> | /// <summary> Disconnects from the Discord server, canceling any pending requests. </summary> | ||||
public Task Disconnect() => _taskManager.Stop(true); | public Task Disconnect() => _taskManager.Stop(true); | ||||
private async Task Cleanup() | |||||
private async Task Cleanup() | |||||
{ | { | ||||
var oldState = State; | var oldState = State; | ||||
State = ConnectionState.Disconnecting; | State = ConnectionState.Disconnecting; | ||||
@@ -525,7 +525,11 @@ namespace Discord | |||||
channel.Update(model); | channel.Update(model); | ||||
} | } | ||||
if (largeServers.Count > 0) | if (largeServers.Count > 0) | ||||
GatewaySocket.SendRequestMembers(largeServers, "", 0); | |||||
{ | |||||
int batches = (largeServers.Count + (DiscordConfig.ServerBatchCount - 1)) / DiscordConfig.ServerBatchCount; | |||||
for (int i = 0; i < batches; i++) | |||||
GatewaySocket.SendRequestMembers(largeServers.Skip(i * DiscordConfig.ServerBatchCount), "", 0); | |||||
} | |||||
else | else | ||||
EndConnect(); | EndConnect(); | ||||
} | } | ||||
@@ -61,6 +61,7 @@ namespace Discord | |||||
internal const int RestTimeout = 10000; | internal const int RestTimeout = 10000; | ||||
internal const int MessageQueueInterval = 100; | internal const int MessageQueueInterval = 100; | ||||
internal const int WebSocketQueueInterval = 100; | internal const int WebSocketQueueInterval = 100; | ||||
internal const int ServerBatchCount = 50; | |||||
public const string LibName = "Discord.Net"; | public const string LibName = "Discord.Net"; | ||||
public static string LibVersion => typeof(DiscordConfigBuilder).GetTypeInfo().Assembly.GetName().Version.ToString(3); | public static string LibVersion => typeof(DiscordConfigBuilder).GetTypeInfo().Assembly.GetName().Version.ToString(3); | ||||
@@ -88,7 +89,6 @@ namespace Discord | |||||
public bool UsePermissionsCache { get; } | public bool UsePermissionsCache { get; } | ||||
public bool EnablePreUpdateEvents { get; } | public bool EnablePreUpdateEvents { get; } | ||||
internal DiscordConfig(DiscordConfigBuilder builder) | internal DiscordConfig(DiscordConfigBuilder builder) | ||||
{ | { | ||||
LogLevel = builder.LogLevel; | LogLevel = builder.LogLevel; | ||||