bunqueue v2.9 API referenceall versions · guide
bunqueue
    Preparing search index...

    Class ConcurrencyLimiter

    Concurrency limiter: admits at most limit jobs of a queue at once.

    It records which job ids hold a slot rather than a bare counter, so acquire and release are symmetric per job: releasing a job that holds no slot (one that was released already, or that is not active) is a no-op and can never open a phantom slot. A limiter created while jobs of the queue are already active is seeded with their ids, so they count toward the new limit.

    Index
    • Update limit; the jobs holding a slot keep it.

      Parameters

      • limit: number

      Returns void

    • Try to acquire a slot for jobId; a job that already holds one keeps it.

      Parameters

      Returns boolean