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
|
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 |