Skip to content

v1.1.0

Latest

Choose a tag to compare

@markus-peltola markus-peltola released this 27 Jul 07:52
79413ac

Rate limiting

Severa allows 10 requests per second and responds with 429 Too Many Requests
(API calls quota exceeded! maximum admitted 10 per 1s.) when the quota is exceeded.
The client now handles this on its own, so callers no longer need to add delays when
looping through paginated results.

Added

  • Request pacing. Outgoing requests go through a token bucket, by default 8 requests
    per second with a burst capacity of 8, leaving headroom below Severa's quota.
  • Automatic retry on 429. Rejected requests are retried up to 5 times, using the
    Retry-After header when present and exponential backoff (capped at 30s) otherwise.
    While waiting, all other requests are held back too, so parallel requests back off
    as a whole.
  • New options: replenishRate, burstCapacity and maxRetriesOn429
    (set to 0 to disable retrying). All optional — existing code works unchanged.

Fixed

  • Network-level errors (timeouts, connection resets) no longer fail with
    TypeError: Cannot read properties of undefined (reading 'status') in the error
    handler; the original error is thrown instead.

Notes

  • The rate limiter is per client instance. Several clients in the same process share the
    same Severa quota, so lower replenishRate accordingly.