Remove potential for deadlock in ProfileDataService
This commit is contained in:
@@ -26,7 +26,7 @@ public class ProfileDataService(ISptLogger<ProfileDataService> logger, FileUtil
|
||||
value = jsonUtil.Deserialize<T>(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<ProfileDataService> 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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user