From 3b41b551cab2ca534eb19bd7f2809c238b0e169d Mon Sep 17 00:00:00 2001 From: Chomp Date: Sat, 26 Apr 2025 23:12:19 +0100 Subject: [PATCH] Renamed lock vars to match convention --- .../Extensions/StringExtensions.cs | 16 ++++++++-------- .../Controllers/BotController.cs | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Libraries/SPTarkov.Common/Extensions/StringExtensions.cs b/Libraries/SPTarkov.Common/Extensions/StringExtensions.cs index 4910e4a5..c444e332 100644 --- a/Libraries/SPTarkov.Common/Extensions/StringExtensions.cs +++ b/Libraries/SPTarkov.Common/Extensions/StringExtensions.cs @@ -5,18 +5,18 @@ namespace SPTarkov.Common.Extensions; public static class StringExtensions { - private static readonly Dictionary RegexCache = new(); - private static readonly Lock RegexCacheLock = new(); + private static readonly Dictionary _regexCache = new(); + private static readonly Lock _regexCacheLock = new(); public static string RegexReplace(this string source, [StringSyntax(StringSyntaxAttribute.Regex)] string regexString, string newValue) { Regex regex; - lock (RegexCacheLock) + lock (_regexCacheLock) { - if (!RegexCache.TryGetValue(regexString, out regex)) + if (!_regexCache.TryGetValue(regexString, out regex)) { regex = new Regex(regexString); - RegexCache[regexString] = regex; + _regexCache[regexString] = regex; } } @@ -26,12 +26,12 @@ public static class StringExtensions public static bool RegexMatch(this string source, [StringSyntax(StringSyntaxAttribute.Regex)] string regexString, out Match? matchedString) { Regex regex; - lock (RegexCacheLock) + lock (_regexCacheLock) { - if (!RegexCache.TryGetValue(regexString, out regex)) + if (!_regexCache.TryGetValue(regexString, out regex)) { regex = new Regex(regexString); - RegexCache[regexString] = regex; + _regexCache[regexString] = regex; } } diff --git a/Libraries/SPTarkov.Server.Core/Controllers/BotController.cs b/Libraries/SPTarkov.Server.Core/Controllers/BotController.cs index 90397713..a0bc1189 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/BotController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/BotController.cs @@ -39,7 +39,7 @@ public class BotController( { private readonly BotConfig _botConfig = _configServer.GetConfig(); private readonly PmcConfig _pmcConfig = _configServer.GetConfig(); - private static readonly Lock BotListLock = new(); + private static readonly Lock _botListLock = new(); /// /// Return the number of bot load-out varieties to be generated @@ -202,7 +202,7 @@ public class BotController( condition.Limit), // Choose largest between value passed in from request vs what's in bot.config _botHelper.IsBotPmc(condition.Role)); - lock (BotListLock) + lock (_botListLock) { result.AddRange(GenerateBotWave(condition, botWaveGenerationDetails, sessionId)); }