forked from TeamInklings/Octobot
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:
parent
1c13f0a310
commit
eaeacc1206
3 changed files with 3 additions and 3 deletions
|
@ -58,7 +58,6 @@ resharper_indent_nested_usings_stmt = true
|
||||||
resharper_indent_nested_while_stmt = true
|
resharper_indent_nested_while_stmt = true
|
||||||
resharper_indent_preprocessor_if = usual_indent
|
resharper_indent_preprocessor_if = usual_indent
|
||||||
resharper_indent_preprocessor_other = usual_indent
|
resharper_indent_preprocessor_other = usual_indent
|
||||||
resharper_int_align_fields = true
|
|
||||||
resharper_int_align_methods = true
|
resharper_int_align_methods = true
|
||||||
resharper_int_align_parameters = true
|
resharper_int_align_parameters = true
|
||||||
resharper_int_align_properties = true
|
resharper_int_align_properties = true
|
||||||
|
|
|
@ -23,7 +23,7 @@ public static class Boyfriend {
|
||||||
};
|
};
|
||||||
|
|
||||||
private static DateTimeOffset _nextSongAt = DateTimeOffset.MinValue;
|
private static DateTimeOffset _nextSongAt = DateTimeOffset.MinValue;
|
||||||
private static uint _nextSongIndex;
|
private static uint _nextSongIndex;
|
||||||
|
|
||||||
private static readonly Tuple<Game, TimeSpan>[] ActivityList = {
|
private static readonly Tuple<Game, TimeSpan>[] ActivityList = {
|
||||||
Tuple.Create(
|
Tuple.Create(
|
||||||
|
@ -72,6 +72,8 @@ public static class Boyfriend {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async void TickAllGuildsAsync(object? sender, ElapsedEventArgs e) {
|
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));
|
foreach (var guild in Client.Guilds) GuildTickTasks.Add(TickGuildAsync(guild));
|
||||||
|
|
||||||
try { Task.WaitAll(GuildTickTasks.ToArray()); } catch (AggregateException ex) {
|
try { Task.WaitAll(GuildTickTasks.ToArray()); } catch (AggregateException ex) {
|
||||||
|
|
|
@ -74,7 +74,6 @@ public record GuildData {
|
||||||
MemberData.Add(deserialised!.Id, deserialised);
|
MemberData.Add(deserialised!.Id, deserialised);
|
||||||
}
|
}
|
||||||
|
|
||||||
guild.DownloadUsersAsync().Wait();
|
|
||||||
foreach (var member in guild.Users.Where(user => !user.IsBot)) {
|
foreach (var member in guild.Users.Where(user => !user.IsBot)) {
|
||||||
if (MemberData.TryGetValue(member.Id, out var memberData)) {
|
if (MemberData.TryGetValue(member.Id, out var memberData)) {
|
||||||
if (!memberData.IsInGuild
|
if (!memberData.IsInGuild
|
||||||
|
|
Reference in a new issue