diff --git a/discord/http.py b/discord/http.py index 8ca579da8..5540eb18c 100644 --- a/discord/http.py +++ b/discord/http.py @@ -568,7 +568,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 35b5ce0da..b5daa35bf 100644 --- a/discord/webhook/async_.py +++ b/discord/webhook/async_.py @@ -186,7 +186,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) @@ -196,9 +199,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 7592bcf60..04c93e437 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