Misc code enhancements

This commit is contained in:
Łukasz Domeradzki
2024-04-04 02:15:16 +02:00
parent 990e696b37
commit 1841cde776
8 changed files with 32 additions and 29 deletions

View File

@@ -488,7 +488,7 @@ internal static class Program {
// Stop all the active bots so they can disconnect cleanly
if (Bot.Bots?.Count > 0) {
// Stop() function can block due to SK2 sockets, don't forget a maximum delay
await Task.WhenAny(Utilities.InParallel(Bot.Bots.Values.Select(static bot => Task.Run(() => bot.Stop(true)))), Task.Delay(Bot.Bots.Count * WebBrowser.MaxTries * 1000)).ConfigureAwait(false);
await Task.WhenAny(Utilities.InParallel(Bot.Bots.Values.Select(static bot => Task.Run(() => bot.Stop(true)))), Task.Delay((Bot.Bots.Count + WebBrowser.MaxTries) * 1000)).ConfigureAwait(false);
// Extra second for Steam requests to go through
await Task.Delay(1000).ConfigureAwait(false);