Interface BetterLockOptions

Options that apply on BetterLock instance

Hierarchy

Properties

execution_timeout?: number

How long can a job be executing before timing out. Null to disable timeout. If you do that, though, and you have a swallowed callback, the lock can remain locked permanently.

extend_stack_traces?: boolean

In any error produced by BetterLock, extend the stack trace to include incoming trace. Defaults to true.

log?: boolean | ((msg: string) => void)

Whether to log the internal actions. Set to true to use console.log. Alternatively, provide your own function

name?: string

Lock name. This will be written in all logs and error messages, to help you distinguish between different locks

queue_ejection_strategy?: BetterLockQueueEjectionStrategy

If queue is full, which job to eject. Defaults to 'oldest'.

queue_size?: number

Max queue size for waiting jobs.

wait_timeout?: number

How long can jobs wait in queue before timing out. Null to disable timeout.

Methods

  • promise_tester(maybePromise: any): boolean
  • Function that detects whether value returned by executor is a promise. This will ducktype-sniff the returned value. Depending on your Promise library of choice, you might want to tighten or loosen this bit.

    Parameters

    • maybePromise: any

    Returns boolean

Generated using TypeDoc