Improve server bundle loading
Speeds up SPT server initialization and reduces allocations when a lot of bundle mods are active
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using SPTarkov.DI.Annotations;
|
||||
using SPTarkov.Server.Core.Models.Eft.Profile;
|
||||
using SPTarkov.Server.Core.Models.Utils;
|
||||
using SPTarkov.Server.Core.Utils;
|
||||
|
||||
@@ -79,7 +78,7 @@ public class BundleHashCacheService(ISptLogger<BundleHashCacheService> logger, J
|
||||
|
||||
if (!MatchWithStoredHash(BundlePath, hash))
|
||||
{
|
||||
await StoreValue(BundlePath, await CalculateHash(BundlePath));
|
||||
await StoreValue(BundlePath, hash);
|
||||
}
|
||||
|
||||
return hash;
|
||||
@@ -87,7 +86,7 @@ public class BundleHashCacheService(ISptLogger<BundleHashCacheService> logger, J
|
||||
|
||||
protected async Task<uint> CalculateHash(string BundlePath)
|
||||
{
|
||||
return hashUtil.GenerateCrc32ForData(await fileUtil.ReadFileAsBytesAsync(BundlePath));
|
||||
return await hashUtil.GenerateCrc32ForFileAsync(BundlePath);
|
||||
}
|
||||
|
||||
protected bool MatchWithStoredHash(string BundlePath, uint hash)
|
||||
|
||||
Reference in New Issue
Block a user