Browse Source

Added delay to member request batching

pull/44/head
RogueException 9 years ago
parent
commit
a357a06d33
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      src/Discord.Net/DiscordClient.cs

+ 5
- 1
src/Discord.Net/DiscordClient.cs View File

@@ -477,7 +477,7 @@ namespace Discord
#endregion #endregion


#region Gateway Events #region Gateway Events
private void OnReceivedEvent(WebSocketEventEventArgs e)
private async void OnReceivedEvent(WebSocketEventEventArgs e)
{ {
try try
{ {
@@ -528,7 +528,11 @@ namespace Discord
{ {
int batches = (largeServers.Count + (DiscordConfig.ServerBatchCount - 1)) / DiscordConfig.ServerBatchCount; int batches = (largeServers.Count + (DiscordConfig.ServerBatchCount - 1)) / DiscordConfig.ServerBatchCount;
for (int i = 0; i < batches; i++) for (int i = 0; i < batches; i++)
{
GatewaySocket.SendRequestMembers(largeServers.Skip(i * DiscordConfig.ServerBatchCount).Take(DiscordConfig.ServerBatchCount), "", 0); GatewaySocket.SendRequestMembers(largeServers.Skip(i * DiscordConfig.ServerBatchCount).Take(DiscordConfig.ServerBatchCount), "", 0);
if (i != batches - 1)
await Task.Delay(1500);
}
} }
else else
EndConnect(); EndConnect();


Loading…
Cancel
Save