Type alias LockFunc

LockFunc: (<R>(name: string, acquireTimeout: number, fn: (() => Promise<R>)) => Promise<R>)

Type declaration

    • <R>(name: string, acquireTimeout: number, fn: (() => Promise<R>)): Promise<R>
    • Experimental

      Provide your own global lock implementation instead of the default implementation. The function should acquire a lock for the duration of the fn async function, such that no other client instances will be able to hold it at the same time.

      Type Parameters

      • R

      Parameters

      • name: string

        Name of the lock to be acquired.

      • acquireTimeout: number

        If negative, no timeout should occur. If positive it should throw an Error with an isAcquireTimeout property set to true if the operation fails to be acquired after this much time (ms).

      • fn: (() => Promise<R>)

        The operation to execute when the lock is acquired.

          • (): Promise<R>
          • Returns Promise<R>

      Returns Promise<R>

Generated using TypeDoc