|
@ -189,9 +189,8 @@ class AsyncWebhookAdapter: |
|
|
if remaining == '0' and response.status != 429: |
|
|
if remaining == '0' and response.status != 429: |
|
|
delta = utils._parse_ratelimit_header(response) |
|
|
delta = utils._parse_ratelimit_header(response) |
|
|
_log.debug( |
|
|
_log.debug( |
|
|
'Webhook ID %s has exhausted its rate limit bucket (bucket: %s, retry: %s).', |
|
|
'Webhook ID %s has exhausted its rate limit bucket (retry: %s).', |
|
|
webhook_id, |
|
|
webhook_id, |
|
|
bucket, |
|
|
|
|
|
delta, |
|
|
delta, |
|
|
) |
|
|
) |
|
|
lock.delay_by(delta) |
|
|
lock.delay_by(delta) |
|
@ -202,10 +201,10 @@ class AsyncWebhookAdapter: |
|
|
if response.status == 429: |
|
|
if response.status == 429: |
|
|
if not response.headers.get('Via'): |
|
|
if not response.headers.get('Via'): |
|
|
raise HTTPException(response, data) |
|
|
raise HTTPException(response, data) |
|
|
fmt = 'Webhook ID %s is rate limited. Retrying in %.2f seconds. Handled under the bucket %s' |
|
|
fmt = 'Webhook ID %s is rate limited. Retrying in %.2f seconds.' |
|
|
|
|
|
|
|
|
retry_after: float = data['retry_after'] # type: ignore |
|
|
retry_after: float = data['retry_after'] # type: ignore |
|
|
_log.warning(fmt, webhook_id, retry_after, bucket, stack_info=True) |
|
|
_log.warning(fmt, webhook_id, retry_after) |
|
|
await asyncio.sleep(retry_after) |
|
|
await asyncio.sleep(retry_after) |
|
|
continue |
|
|
continue |
|
|
|
|
|
|
|
|