SequentialBucket

SequentialBucket

Ratelimit requests and release in sequence TODO: add latencyref

Constructor

new SequentialBucket(limit, latencyRefopt)

Construct a SequentialBucket

Properties:
Name Type Description
limit Number

How many tokens the bucket can consume in the current interval

processing Boolean

Whether the queue is being processed

remaining Number

How many tokens the bucket has left in the current interval

reset Number

Timestamp of next reset

Source:
Parameters:
Name Type Attributes Description
limit Number

The max number of tokens the bucket can consume per interval

latencyRef Object <optional>

An object

Name Type Description
latency Number

Interval between consuming tokens

Methods

queue(func)

Queue something in the SequentialBucket

Source:
Parameters:
Name Type Description
func function

A function to call when a token can be consumed. The function will be passed a callback argument, which must be called to allow the bucket to continue to work