disgord icon indicating copy to clipboard operation
disgord copied to clipboard

Rate limit using round tripper

Open andersfylling opened this issue 3 years ago • 1 comments

Description

This is a simpler version than https://github.com/andersfylling/disgord/pull/332

Here golang.org/x/time/rate is used. And non-cancellation situation are accepted (when awaiting reservation).

This design is also concurrent when possible. First request blocks all requests, but if discord returns insight on burst information, that will be utilized after.

It has not yet been decided if the next set of burst limit should be predicted or fetched.

Type of change

  • [x] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [x] Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • [ ] I ran go generate
  • [ ] I have performed a self-review of my own code (remember to run go fmt ./...)
  • [ ] I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [ ] I have added tests that prove my fix is effective or that my feature works
  • [ ] New and existing unit tests pass locally with my changes
  • [ ] Any dependent changes have been merged and published in downstream modules
  • [ ] Added benchmarks if this is a performant required component (potential bottlenecks)

andersfylling avatar Nov 25 '20 03:11 andersfylling

I don't recommend this implementation for Discord Rate Limits.

switchupcb avatar Jul 28 '22 15:07 switchupcb