Skip to content

Feature: Implement X-Ratelimit-Reset-After

Mateusz Brawański requested to merge github/fork/Neuheit/patch/580 into master

Created by: Neuheit

Summary

Fixes #580 (closed).

Details

This will allow clients to decide whether to compute ratelimits using this header, which will have a slightly longer reset time to reduce the risk of hitting a ratelimit. This is true by default, but clients can use the old method by setting UseRelativeRatelimit to false.

This was tested by spamming the following endpoints:

POST channels/channel_id/messages (should work for the other endpoints as well)

DELETE channels/channel_id/messages/message_id (special endpoint)

POST webhooks/webhook_id/webhook_token (due to weirdness with webhooks)

Changes proposed

  • Add support for this header, enabled by default but can be toggled off.
  • Made a few grammatical changes in the logger and with comments.

Notes

The only thing which may throw an occasional 429 would be spamming delete message, but there is no practical reason to do this.

Merge request reports

Loading