Provides built-in rate-limiting functionality.
Methods
(async, inner) enforce()
Enforces compliance with the API's general rate-limit.
Depending on how many requests have been sent to the NS API in the current time window already, further execution is paused for an appropriate amount of time, until a new request can be made again safely.
(async, inner) enforceTG(isRecruit)
Enforces compliance with the API's telegram rate-limit.
Depending on when the last telegram request was sent, further execution is paused for an appropriate amount of time, until a new telegram request can be made again safely.
Parameters:
Name | Type | Description |
---|---|---|
isRecruit |
boolean |
|
(inner) update(data)
Updates the rate-limiters records with data supplied by the API.
Parameters:
Name | Type | Description |
---|---|---|
data |
http.IncomingHttpHeaders | Headers returned |