1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-05-03 20:49:54 +03:00

Fix a critical performance issue in GuildData, skip guild ticks if running behind

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
Octol1ttle 2023-02-02 00:16:31 +05:00
parent 1c13f0a310
commit eaeacc1206
Signed by: Octol1ttle
GPG key ID: B77C34313AEE1FFF
3 changed files with 3 additions and 3 deletions

View file

@ -23,7 +23,7 @@ public static class Boyfriend {
};
private static DateTimeOffset _nextSongAt = DateTimeOffset.MinValue;
private static uint _nextSongIndex;
private static uint _nextSongIndex;
private static readonly Tuple<Game, TimeSpan>[] ActivityList = {
Tuple.Create(
@ -72,6 +72,8 @@ public static class Boyfriend {
}
private static async void TickAllGuildsAsync(object? sender, ElapsedEventArgs e) {
if (GuildTickTasks.Count is not 0) return;
foreach (var guild in Client.Guilds) GuildTickTasks.Add(TickGuildAsync(guild));
try { Task.WaitAll(GuildTickTasks.ToArray()); } catch (AggregateException ex) {