fix(server): same identify across pods (#9428)

This commit is contained in:
darkskygit
2024-12-30 09:25:31 +00:00
parent 08ebfb6e70
commit 47ba0a8a32
@@ -14,6 +14,7 @@ export const MUTEX_WAIT = 100;
@Injectable() @Injectable()
export class Mutex { export class Mutex {
protected logger = new Logger(Mutex.name); protected logger = new Logger(Mutex.name);
private readonly clusterIdentifier = `cluster:${randomUUID()}`;
constructor(protected readonly locker: Locker) {} constructor(protected readonly locker: Locker) {}
@@ -38,7 +39,7 @@ export class Mutex {
* @param key resource key * @param key resource key
* @returns LockGuard * @returns LockGuard
*/ */
async acquire(key: string, owner: string = 'global') { async acquire(key: string, owner: string = this.clusterIdentifier) {
try { try {
return await retryable( return await retryable(
() => this.locker.lock(owner, key), () => this.locker.lock(owner, key),