Understand Buckets & Headers
Respect X-RateLimit-*
and Retry-After
. Implement per-route buckets and a scheduler queue.
Retry with Backoff
On 429, pause for Retry-After
. Add jitter to avoid thundering herds. Idempotency keys prevent duplicate side effects.
Shard and Cache
Distribute traffic across shards. Cache guild/channel metadata and computed results to reduce API pressure.
Prioritize
Queue by priority: moderation > user replies > analytics. Drop or delay non-critical jobs during spikes.
Observability
Export per-bucket metrics: remaining, resets, 429 count, average wait time. Alert on sustained saturation.