From fd47c47c3e04900035ead761cf5012c3f47645ae Mon Sep 17 00:00:00 2001 From: Cj <161484149+CJ-SPT@users.noreply.github.com> Date: Sun, 19 Oct 2025 01:13:46 -0400 Subject: [PATCH] Remove potential for deadlock in ProfileDataService --- .../SPTarkov.Server.Core/Services/Mod/ProfileDataService.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Libraries/SPTarkov.Server.Core/Services/Mod/ProfileDataService.cs b/Libraries/SPTarkov.Server.Core/Services/Mod/ProfileDataService.cs index 85941807..486b427d 100644 --- a/Libraries/SPTarkov.Server.Core/Services/Mod/ProfileDataService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/Mod/ProfileDataService.cs @@ -26,7 +26,7 @@ public class ProfileDataService(ISptLogger logger, FileUtil value = jsonUtil.Deserialize(fileUtil.ReadFile($"{ProfileDataFilepath}{profileId}/{modKey}.json")); if (value != null) { - while (!_profileDataCache.TryAdd(profileDataKey, value)) { } + _profileDataCache[$"{profileId}:{modKey}"] = value; } } else @@ -48,8 +48,7 @@ public class ProfileDataService(ISptLogger logger, FileUtil throw new Exception("The profile data when serialized resulted in a null value"); } - while (!_profileDataCache.TryAdd($"{profileId}:{modKey}", profileData)) { } - + _profileDataCache[$"{profileId}:{modKey}"] = profileData; fileUtil.WriteFile($"{ProfileDataFilepath}{profileId}/{modKey}.json", data); } }