Browse Source

Fix broken rename from pyright

pull/7443/head
Rapptz 4 years ago
parent
commit
1b5c206279
  1. 12
      discord/shard.py

12
discord/shard.py

@ -153,10 +153,10 @@ class Shard:
return return
if e.code != 1000: if e.code != 1000:
self._queue_put(EventItem(EventType.close, self, e)) self._queue_put(EventItem(EventType.close, self, e))
_log return return
retry = self._backoff.delay() retry = self._backoff.delay()
log.error('Attempting a reconnect for shard ID %s in %.2fs', self.id, retry, exc_info=e) _log.error('Attempting a reconnect for shard ID %s in %.2fs', self.id, retry, exc_info=e)
await asyncio.sleep(retry) await asyncio.sleep(retry)
self._queue_put(EventItem(EventType.reconnect, self, e)) self._queue_put(EventItem(EventType.reconnect, self, e))
@ -178,10 +178,10 @@ class Shard:
break break
async def reidentify(self, exc: ReconnectWebSocket) -> None: async def reidentify(self, exc: ReconnectWebSocket) -> None:
_logf._cancel_task() self._cancel_task()
self._dispatch('disconnect') self._dispatch('disconnect')
self._dispatch('shard_disconnect', self.id) self._dispatch('shard_disconnect', self.id)
log.info('Got a request to %s the websocket at Shard ID %s.', exc.op, self.id) _log.info('Got a request to %s the websocket at Shard ID %s.', exc.op, self.id)
try: try:
coro = DiscordWebSocket.from_client( coro = DiscordWebSocket.from_client(
self._client, self._client,
@ -377,7 +377,7 @@ class AutoShardedClient(Client):
def get_shard(self, shard_id: int) -> Optional[ShardInfo]: def get_shard(self, shard_id: int) -> Optional[ShardInfo]:
"""Optional[:class:`ShardInfo`]: Gets the shard information at a given shard ID or ``None`` if not found.""" """Optional[:class:`ShardInfo`]: Gets the shard information at a given shard ID or ``None`` if not found."""
try: try:
_logent = self.__shards[shard_id] parent = self.__shards[shard_id]
except KeyError: except KeyError:
return None return None
else: else:
@ -393,7 +393,7 @@ class AutoShardedClient(Client):
coro = DiscordWebSocket.from_client(self, initial=initial, gateway=gateway, shard_id=shard_id) coro = DiscordWebSocket.from_client(self, initial=initial, gateway=gateway, shard_id=shard_id)
ws = await asyncio.wait_for(coro, timeout=180.0) ws = await asyncio.wait_for(coro, timeout=180.0)
except Exception: except Exception:
log.exception('Failed to connect for shard_id: %s. Retrying...', shard_id) _log.exception('Failed to connect for shard_id: %s. Retrying...', shard_id)
await asyncio.sleep(5.0) await asyncio.sleep(5.0)
return await self.launch_shard(gateway, shard_id) return await self.launch_shard(gateway, shard_id)

Loading…
Cancel
Save