Browse Source
Revert typehint in Ratelimit.update()
pull/10287/head
imp
2 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
2 additions and
2 deletions
-
discord/http.py
|
|
@ -391,11 +391,11 @@ class Ratelimit: |
|
|
|
self.remaining = self.limit - self.outgoing |
|
|
|
self.reset_at = 0.0 |
|
|
|
|
|
|
|
def update(self, response: aiohttp.ClientResponse, data: Dict[str, Any]) -> bool: |
|
|
|
def update(self, response: aiohttp.ClientResponse, data: Union[Dict[str, Any], str]) -> bool: |
|
|
|
# Shared scope 429 has longer "reset_at", determined using the retry-after field |
|
|
|
limit = int(response.headers['X-Ratelimit-Limit']) |
|
|
|
if response.headers.get('X-RateLimit-Scope') == 'shared': |
|
|
|
reset_at = self.http.loop.time() + data['retry_after'] |
|
|
|
reset_at = self.http.loop.time() + data['retry_after'] # type: ignore |
|
|
|
remaining = 0 |
|
|
|
else: |
|
|
|
# Consider a lower remaining value because updates can be out of order, so self.outgoing is used |
|
|
|