MCPcopy
hub / github.com/msgbyte/tianji / withDistributedLock

Function withDistributedLock

src/server/cache/distributedLock.ts:347–353  ·  view source on GitHub ↗
(
  lockName: string,
  fn: () => Promise<T>,
  options?: Partial<DistributedLockOptions>
)

Source from the content-addressed store, hash-verified

345 * @returns Promise<T | null> - Result or null if lock couldn't be acquired
346 */
347export async function withDistributedLock<T>(
348 lockName: string,
349 fn: () => Promise<T>,
350 options?: Partial<DistributedLockOptions>
351): Promise<T | null> {
352 return distributedLock.withLock(lockName, fn, options);
353}

Callers 5

checkQuotaAlertFunction · 0.85
runWorkerMethod · 0.85
runMonitorMethod · 0.85
syncPostgresToClickHouseFunction · 0.85
initCronjobFunction · 0.85

Calls 1

withLockMethod · 0.80

Tested by

no test coverage detected