Commit graph

4 commits

Author SHA1 Message Date
Carson Hoffman
0f0aaad011
Correct header in rate limit test 2021-01-20 19:48:09 -05:00
Carson Hoffman
b7a2a4b7fa
Correct rate limit test magnitude 2021-01-20 19:42:53 -05:00
Carson Hoffman
866ecccb2e
Support millisecond precision in rate limits 2021-01-20 18:39:43 -05:00
jonas747
56b19073d3 Ratelimits (#273)
* Added ratelimiter

Handles the new ratelimit headers
 - X-RateLimit-Remaining
 - X-RateLimit-Reset
 - X-RateLimit-Global

* Pad only reset time with a second

* Moved ratelimiter out of internal package

* Change for loop, move global ratelimit check inside sleep check

* Moved ratelimiter locking to getBucket

* Added global bucket

* Changed how bucket id's are done

Now each request function will need to specify the bucket id if the
endpoint contains minor variables

* Allow empty bucketID in request

* Remove some uneeded Endpoint* function calls

* Added test for global ratelimits

* Fixed a silly little mistake causing incorrect ratelimits

* Update test comments, Fixed treating a endpoint as 2 in ratelimiting

* Use date header from discord instead of relying on sys time sync

* Update all REST functions to use RequestWithBucketID

* Embed mutex into bucket

* Added webhook and reaction buckets
2016-11-04 08:07:22 -07:00