• Preparing search index...
  • The search index is not available
@daiso-tech/core - v0.56.0
  • @daiso-tech/core
  • Semaphore
  • withSemaphoreFactory

Function withSemaphoreFactory

  • withSemaphoreFactory(
        semaphoreFactory: ISemaphoreFactory,
    ): <TParameters extends unknown[], TReturn>(
        settings: WithSemaphoreSettings<TParameters>,
    ) => MiddlewareFn<TParameters, Promise<TReturn>>
  • Creates a middleware factory that wraps function calls with a distributed semaphore.

    Before executing the wrapped function a slot is acquired on the derived key. If the maximum number of concurrent slots (limit) has already been reached the call waits (or fails immediately for non-blocking semaphores) until a slot becomes available.

    Parameters

    • semaphoreFactory: ISemaphoreFactory

      The semaphore factory to use.

    Returns <TParameters extends unknown[], TReturn>(
        settings: WithSemaphoreSettings<TParameters>,
    ) => MiddlewareFn<TParameters, Promise<TReturn>>

    A function that accepts WithSemaphoreSettings and returns a middleware.

    IMPORT_PATH: "@daiso-tech/core/semaphore/middlewares"

    • Defined in src/semaphore/implementations/middlewares/with-semaphore/with-semaphore-factory.ts:72

Settings

Member Visibility
@daiso-tech/core - v0.56.0
  • Loading...

Generated using TypeDoc