This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

semble / src / shared / infrastructure / locking / IDistributedLockService.ts
675 B 18 lines
1/** 2 * Interface for distributed locking service. 3 * 4 * Provides distributed locking across multiple workers/instances using 5 * a shared lock store (Redis in production, in-memory for development). 6 */ 7export interface IDistributedLockService { 8 /** 9 * Executes a function while holding a distributed lock. 10 * 11 * @param key - The lock key to acquire 12 * @param ttl - Time-to-live for the lock in milliseconds 13 * @param fn - The function to execute while holding the lock 14 * @returns The result of the function execution 15 * @throws Error if lock cannot be acquired after retries 16 */ 17 withLock<T>(key: string, ttl: number, fn: () => Promise<T>): Promise<T>; 18}