mirror of
https://github.com/sp-tarkov/server.git
synced 2025-02-13 09:50:43 -05:00
Hash mods asynchronously
This commit is contained in:
parent
ab1b5cd30e
commit
e86ceb89ce
@ -42,7 +42,7 @@ export class ModCompilerService {
|
||||
}
|
||||
}
|
||||
|
||||
const hashMatches = this.modHashCacheService.calculateAndCompareHash(modName, tsFileContents);
|
||||
const hashMatches = await this.modHashCacheService.calculateAndCompareHash(modName, tsFileContents);
|
||||
|
||||
if (fileExists && hashMatches) {
|
||||
// Everything exists and matches, escape early
|
||||
@ -51,7 +51,7 @@ export class ModCompilerService {
|
||||
|
||||
if (!hashMatches) {
|
||||
// Store / update hash in json file
|
||||
this.modHashCacheService.calculateAndStoreHash(modName, tsFileContents);
|
||||
await this.modHashCacheService.calculateAndStoreHash(modName, tsFileContents);
|
||||
}
|
||||
|
||||
return this.compile(modTypeScriptFiles, {
|
||||
|
@ -38,14 +38,14 @@ export class ModHashCacheService {
|
||||
return this.getStoredValue(modName) === hash;
|
||||
}
|
||||
|
||||
public calculateAndCompareHash(modName: string, modContent: string): boolean {
|
||||
const generatedHash = this.hashUtil.generateSha1ForData(modContent);
|
||||
public async calculateAndCompareHash(modName: string, modContent: string): Promise<boolean> {
|
||||
const generatedHash = await this.hashUtil.generateSha1ForDataAsync(modContent);
|
||||
|
||||
return this.matchWithStoredHash(modName, generatedHash);
|
||||
}
|
||||
|
||||
public calculateAndStoreHash(modName: string, modContent: string): void {
|
||||
const generatedHash = this.hashUtil.generateSha1ForData(modContent);
|
||||
public async calculateAndStoreHash(modName: string, modContent: string): Promise<void> {
|
||||
const generatedHash = await this.hashUtil.generateSha1ForDataAsync(modContent);
|
||||
|
||||
this.storeValue(modName, generatedHash);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user