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:
Archangel
2026-02-07 00:13:50 +01:00
parent 90c577bd29
commit 4b1cad1c90
3 changed files with 56 additions and 21 deletions
@@ -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)