Merge pull request #188 from hulkhan22/fix/multithread-access-list

fix: Crash when generating bots / multithreading improvements #187
This commit is contained in:
Chomp
2025-04-26 23:10:16 +01:00
committed by GitHub
@@ -39,6 +39,7 @@ public class BotController(
{
private readonly BotConfig _botConfig = _configServer.GetConfig<BotConfig>();
private readonly PmcConfig _pmcConfig = _configServer.GetConfig<PmcConfig>();
private static readonly Lock BotListLock = new();
/// <summary>
/// Return the number of bot load-out varieties to be generated
@@ -201,7 +202,10 @@ public class BotController(
condition.Limit), // Choose largest between value passed in from request vs what's in bot.config
_botHelper.IsBotPmc(condition.Role));
result.AddRange(GenerateBotWave(condition, botWaveGenerationDetails, sessionId));
lock (BotListLock)
{
result.AddRange(GenerateBotWave(condition, botWaveGenerationDetails, sessionId));
}
})).ToArray());
stopwatch.Stop();