diff --git a/discord/http.py b/discord/http.py index 2b3f9f1cc..147b9106e 100644 --- a/discord/http.py +++ b/discord/http.py @@ -471,7 +471,7 @@ class HTTPClient: # sleep a bit retry_after: float = data['retry_after'] - _log.warning(fmt, retry_after, bucket) + _log.warning(fmt, retry_after, bucket, stack_info=True) # check if it's a global rate limit is_global = data.get('global', False) diff --git a/discord/webhook/async_.py b/discord/webhook/async_.py index 8d7ddcac2..d11507fcd 100644 --- a/discord/webhook/async_.py +++ b/discord/webhook/async_.py @@ -187,7 +187,10 @@ class AsyncWebhookAdapter: if remaining == '0' and response.status != 429: delta = utils._parse_ratelimit_header(response) _log.debug( - 'Webhook ID %s has been pre-emptively rate limited, waiting %.2f seconds', webhook_id, delta + 'Webhook ID %s has exhausted its rate limit bucket (bucket: %s, retry: %s).', + webhook_id, + bucket, + delta, ) lock.delay_by(delta) @@ -197,9 +200,10 @@ class AsyncWebhookAdapter: if response.status == 429: if not response.headers.get('Via'): raise HTTPException(response, data) + fmt = 'Webhook ID %s is rate limited. Retrying in %.2f seconds. Handled under the bucket %s' retry_after: float = data['retry_after'] # type: ignore - _log.warning('Webhook ID %s is rate limited. Retrying in %.2f seconds', webhook_id, retry_after) + _log.warning(fmt, webhook_id, retry_after, bucket, stack_info=True) await asyncio.sleep(retry_after) continue diff --git a/discord/webhook/sync.py b/discord/webhook/sync.py index 24ca39717..e5e23e357 100644 --- a/discord/webhook/sync.py +++ b/discord/webhook/sync.py @@ -188,7 +188,10 @@ class WebhookAdapter: if remaining == '0' and response.status_code != 429: delta = utils._parse_ratelimit_header(response) _log.debug( - 'Webhook ID %s has been pre-emptively rate limited, waiting %.2f seconds', webhook_id, delta + 'Webhook ID %s has exhausted its rate limit bucket (bucket: %s, retry: %s).', + webhook_id, + bucket, + delta, ) lock.delay_by(delta) @@ -198,9 +201,10 @@ class WebhookAdapter: if response.status_code == 429: if not response.headers.get('Via'): raise HTTPException(response, data) + fmt = 'Webhook ID %s is rate limited. Retrying in %.2f seconds. Handled under the bucket %s' retry_after: float = data['retry_after'] # type: ignore - _log.warning('Webhook ID %s is rate limited. Retrying in %.2f seconds', webhook_id, retry_after) + _log.warning(fmt, webhook_id, retry_after, stack_info=True) time.sleep(retry_after) continue