fix: Different ratelimits for the same route (implement discord buckets) (#1546)

* Don't disable when there's no resetTick

Sometimes Discord won't send any ratelimit headers, disabling the semaphore for endpoints that should have them.

* Undo changes and change comment

* Add HttpMethod to BucketIds

* Add X-RateLimit-Bucket

* BucketId changes

- BucketId is it's own class now
- Add WebhookId as a major parameter
- Add shared buckets using the hash and major parameters

* Add webhookId to BucketIds

* Update BucketId and redirect requests

* General bugfixes

* Assign semaphore and follow the same standard as Reset for ResetAfter
This commit is contained in:
Paulo
2020-08-05 21:16:21 -03:00
committed by GitHub
parent 421a0c12cc
commit 2f6c0175c8
9 changed files with 269 additions and 64 deletions

View File

@@ -1,3 +1,4 @@
using Discord.Net;
using System.Threading;
namespace Discord
@@ -57,7 +58,7 @@ namespace Discord
public bool? UseSystemClock { get; set; }
internal bool IgnoreState { get; set; }
internal string BucketId { get; set; }
internal BucketId BucketId { get; set; }
internal bool IsClientBucket { get; set; }
internal bool IsReactionBucket { get; set; }