From 02e2c9314b63c5433494c2012e4d3b9bb8a9b831 Mon Sep 17 00:00:00 2001 From: Ske Date: Thu, 16 Apr 2020 22:30:13 +0200 Subject: [PATCH] Update webhook rate limit code --- PluralKit.Bot/Services/WebhookRateLimitService.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/PluralKit.Bot/Services/WebhookRateLimitService.cs b/PluralKit.Bot/Services/WebhookRateLimitService.cs index 4977ee6a..7cb03ee1 100644 --- a/PluralKit.Bot/Services/WebhookRateLimitService.cs +++ b/PluralKit.Bot/Services/WebhookRateLimitService.cs @@ -37,6 +37,11 @@ namespace PluralKit.Bot if (!info.hasResetTimeExpired) info.remaining = info.maxLimit; info.hasResetTimeExpired = true; + + // We can hit this multiple times if many requests are in flight before a real one gets "back", so we still + // decrement the remaining request count, this basically "blacklists" the channel given continuous spam until *one* of the requests come back with new rate limit headers + info.remaining--; + return true; }