Interface RateLimiterOptions

Defines the rate limiter options.

Hierarchy

  • RateLimiterOptions

Properties

limitReachedBehavior?: QueueEntryLimitReachedBehavior

Defines behavior when the rate limit is reached.

Remarks

The possible values are:

  • enqueue - Enqueues the request and send it when possible.
  • throw - Throws the RateLimitReachedError exception when rate limit is reached.
  • null - Returns null when rate limit is reached.

Default Value

enqueue

limitToOneRequestPerSecond?: boolean

Limits the number of requests per second to one.

Remarks

According to the official documentation, Donation Alerts API limits requests to the API methods for each application by 60 requests per minute, making it 1 request per second.

The library, by default, limits the number of requests to 1 per second. This means that if you run, for example, 60 concurrent requests at the same time, they will be executed sequentially at 1 request per second.

If you set this option to false, you can reach the rate limit let's say in 10 seconds, and the library will not be able to send requests for the remaining 50 seconds of the available 60 seconds timeframe.

By default, all requests enqueued to execute later when possible. You can change this behavior by setting limitReachedBehavior property.

Default Value

true

Generated using TypeDoc