mirror of
https://github.com/NoiTheCat/BirthdayBot.git
synced 2024-11-21 21:54:36 +00:00
Prevent unnecessary disconnection when user list fetch takes too long
This commit is contained in:
parent
18c52650b3
commit
104d99856b
2 changed files with 5 additions and 3 deletions
|
@ -32,9 +32,11 @@ class AutoUserDownload : BackgroundService {
|
|||
|
||||
var guild = ShardInstance.DiscordClient.GetGuild((ulong)item);
|
||||
if (guild == null) continue; // A guild disappeared...?
|
||||
await guild.DownloadUsersAsync().ConfigureAwait(false); // We're already on a seperate thread, no need to use Task.Run
|
||||
await Task.Delay(200, CancellationToken.None).ConfigureAwait(false); // Must delay, or else it seems to hang...
|
||||
await guild.DownloadUsersAsync(); // We're already on a seperate thread, no need to use Task.Run
|
||||
await Task.Delay(200, CancellationToken.None); // Must delay, or else it seems to hang...
|
||||
processed++;
|
||||
|
||||
if (processed >= 150) break; // take a break (don't get killed by ShardManager for taking too long due to quantity)
|
||||
}
|
||||
|
||||
if (processed > 25) Log($"Explicit user list request processed for {processed} guild(s).");
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommandLineParser" Version="2.9.1" />
|
||||
<PackageReference Include="Discord.Net" Version="3.8.1" />
|
||||
<PackageReference Include="Discord.Net" Version="3.9.0" />
|
||||
<PackageReference Include="EFCore.NamingConventions" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
|
|
Loading…
Reference in a new issue