Skip to content

Commit

Permalink
Merge branch 'dev' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
BrammyS committed Nov 17, 2021
2 parents 83367c3 + 84f7c89 commit c104ad1
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,17 @@ protected override async Task<HttpResponseMessage> ImplementationAsync(Func<Cont
LogRateLimit(updatedBucket, endpoint, false);
if (updatedBucket.IsGlobal)
{
// Prevent rate limit buckets that have been reset from being added.
if (updatedBucket.ResetsAfter <= TimeSpan.Zero) return response;
await _cacheService.CacheValueAsync(DiscordRateLimitBucket.GlobalBucketId, updatedBucket, null, updatedBucket.ResetsAfter);
return response;
}
}

// An non rate limited global request will never get here!!!!!!

// Update the existing bucket.
// Only update the existing bucket if the it isn't already reset.
if (updatedBucket.ResetsAfter <= TimeSpan.Zero) return response;
await _cacheService.CacheValueAsync(endpoint, updatedBucket, null, updatedBucket.ResetsAfter);
return response;
}
Expand Down

0 comments on commit c104ad1

Please sign in to comment.