Browse Source

Merge d9f77651b1 into 322d46e47b

pull/759/merge
Christopher F GitHub 7 years ago
parent
commit
7f8ebaac5d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions
  1. +5
    -0
      src/Discord.Net.Core/RequestOptions.cs
  2. +5
    -2
      src/Discord.Net.Rest/Net/Queue/RequestQueueBucket.cs

+ 5
- 0
src/Discord.Net.Core/RequestOptions.cs View File

@@ -15,6 +15,11 @@ namespace Discord
public RetryMode? RetryMode { get; set; }
public bool HeaderOnly { get; internal set; }
/// <summary>
/// Should this request bypass the ratelimit buckets? This option should be used sparingly, and when used, should be coupled with your own
/// delays between requests, to avoid encountering 429 errors.
/// </summary>
public bool BypassBuckets { get; set; }
/// <summary>
/// The reason for this action in the guild's audit log
/// </summary>
public string AuditLogReason { get; set; }


+ 5
- 2
src/Discord.Net.Rest/Net/Queue/RequestQueueBucket.cs View File

@@ -48,8 +48,11 @@ namespace Discord.Net.Queue
LastAttemptAt = DateTimeOffset.UtcNow;
while (true)
{
await _queue.EnterGlobalAsync(id, request).ConfigureAwait(false);
await EnterAsync(id, request).ConfigureAwait(false);
if (!request.Options.BypassBuckets)
{
await _queue.EnterGlobalAsync(id, request).ConfigureAwait(false);
await EnterAsync(id, request).ConfigureAwait(false);
}

#if DEBUG_LIMITS
Debug.WriteLine($"[{id}] Sending...");


Loading…
Cancel
Save