Compare commits

...

1 Commits

Author SHA1 Message Date
Tom Moor 4b42d811f8 fix: Increase lock timeout for calculating document diff 2025-04-07 22:54:24 -04:00
2 changed files with 7 additions and 6 deletions
@@ -86,7 +86,8 @@ export default class DocumentPublishedOrUpdatedEmail extends BaseEmail<
}
return;
},
30
30,
10000
);
}
+5 -5
View File
@@ -18,11 +18,14 @@ export class CacheHelper {
* @param key Cache key
* @param callback Callback to get the data if not found in cache
* @param expiry Cache data expiry in seconds
* @param lockTimeout Lock timeout in milliseconds
* @returns The data from cache or the result of the callback
*/
public static async getDataOrSet<T>(
key: string,
callback: () => Promise<T | undefined>,
expiry?: number
expiry: number,
lockTimeout: number = MutexLock.defaultLockTimeout
): Promise<T | undefined> {
let cache = await this.getData<T>(key);
@@ -35,10 +38,7 @@ export class CacheHelper {
const lockKey = `lock:${key}`;
try {
try {
lock = await MutexLock.lock.acquire(
[lockKey],
MutexLock.defaultLockTimeout
);
lock = await MutexLock.lock.acquire([lockKey], lockTimeout);
} catch (err) {
Logger.error(`Could not acquire lock for ${key}`, err);
}