mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-02-14 07:43:31 -07:00
Don't add margin for rate limit delays
This commit is contained in:
parent
e5d5f1c85f
commit
324d6bab20
|
|
@ -36,7 +36,7 @@ public class DiscordClient
|
|||
{
|
||||
using var request = new HttpRequestMessage(HttpMethod.Get, new Uri(_baseUri, url));
|
||||
|
||||
// Don't validate because token can have special characters
|
||||
// Don't validate because the token can have special characters
|
||||
// https://github.com/Tyrrrz/DiscordChatExporter/issues/828
|
||||
request.Headers.TryAddWithoutValidation(
|
||||
"Authorization",
|
||||
|
|
@ -68,7 +68,7 @@ public class DiscordClient
|
|||
.Pipe(s => TimeSpan.FromSeconds(double.Parse(s, CultureInfo.InvariantCulture)));
|
||||
|
||||
if (remainingRequestCount <= 0 && resetAfterDelay is not null)
|
||||
await Task.Delay(resetAfterDelay.Value + TimeSpan.FromSeconds(1), innerCancellationToken);
|
||||
await Task.Delay(resetAfterDelay.Value, innerCancellationToken);
|
||||
|
||||
return response;
|
||||
}, cancellationToken);
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ public static class Http
|
|||
{
|
||||
// If rate-limited, use retry-after header as the guide
|
||||
if (result.Result.Headers.RetryAfter?.Delta is { } retryAfter)
|
||||
return retryAfter + TimeSpan.FromSeconds(1);
|
||||
return retryAfter;
|
||||
|
||||
return TimeSpan.FromSeconds(Math.Pow(2, i) + 1);
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue