high level SemaphoreMap

Since

5.18.0

Hierarchy

Constructors

Methods

Constructors

  • SemaphoreMap, provision semaphore with giving key

    Parameters

    • maximumSemObjects: number = ...

      maximumSemObjects to avoid OOM, the default value is 1000000

    • defaultSemCount: number = 10

      default sem permit number, the default value is 10

    Returns SemaphoreMap

Methods

  • wrap a function with semaphore, the different parameter will use different semaphore instance

    simply, it could be used as a deeply 'limit' function, after wrapping, the function will be limited by parameter values (by specific semaphore total count)

    Type Parameters

    • P extends any[]

    • T

    Parameters

    • runner: AsyncFunction<P, T>
    • extractor: ((args) => any) = DEFAULT_EXTRACTOR
        • (args): any
        • Parameters

          • args: P

          Returns any

    Returns AsyncFunction<P, T>