Skip to content

Commit f0e4a97

Browse files
committed
Use ThreadLocal instead of AsyncLocal + remove async for quick & dirty fix
1 parent a5dd91b commit f0e4a97

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ASFFreeGames/ASFFreeGamesPlugin.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ internal static PluginContext Context {
4040
}
4141

4242
// ReSharper disable once InconsistentNaming
43-
private static readonly AsyncLocal<PluginContext> _context = new();
43+
private static readonly ThreadLocal<PluginContext> _context = new();
4444
private static CancellationToken CancellationToken => Context.CancellationToken;
4545

4646
public string Name => StaticName;
@@ -141,7 +141,9 @@ public async void CollectGamesOnClock(object? source) {
141141

142142
if (!cts.IsCancellationRequested) {
143143
string cmd = $"FREEGAMES {FreeGamesCommand.CollectInternalCommandString} " + string.Join(' ', reorderedBots.Select(static bot => bot.BotName));
144-
await OnBotCommand(null!, EAccess.None, cmd, cmd.Split()).ConfigureAwait(false);
144+
#pragma warning disable CS1998
145+
OnBotCommand(null!, EAccess.None, cmd, cmd.Split()).GetAwaiter().GetResult(); // TODO use async
146+
#pragma warning restore CS1998
145147
}
146148
}
147149
}

0 commit comments

Comments
 (0)