Fix more deprecation warnings
This commit is contained in:
parent
1b040fd4ba
commit
4ef0fb0d95
@ -389,7 +389,7 @@ class DiscordWebSocket(websockets.client.WebSocketClientProtocol):
|
|||||||
|
|
||||||
if op == self.INVALIDATE_SESSION:
|
if op == self.INVALIDATE_SESSION:
|
||||||
if data is True:
|
if data is True:
|
||||||
await asyncio.sleep(5.0, loop=self.loop)
|
await asyncio.sleep(5.0)
|
||||||
await self.close()
|
await self.close()
|
||||||
raise ResumeWebSocket(self.shard_id)
|
raise ResumeWebSocket(self.shard_id)
|
||||||
|
|
||||||
|
@ -289,7 +289,7 @@ class AutoShardedClient(Client):
|
|||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
to_close = [shard.ws.close() for shard in self.shards.values()]
|
to_close = [asyncio.ensure_future(shard.ws.close(), loop=self.loop) for shard in self.shards.values()]
|
||||||
if to_close:
|
if to_close:
|
||||||
await asyncio.wait(to_close)
|
await asyncio.wait(to_close)
|
||||||
|
|
||||||
|
@ -328,7 +328,10 @@ async def async_all(gen, *, check=_isawaitable):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
async def sane_wait_for(futures, *, timeout):
|
async def sane_wait_for(futures, *, timeout):
|
||||||
done, pending = await asyncio.wait(futures, timeout=timeout, return_when=asyncio.ALL_COMPLETED)
|
ensured = [
|
||||||
|
asyncio.ensure_future(fut) for fut in futures
|
||||||
|
]
|
||||||
|
done, pending = await asyncio.wait(ensured, timeout=timeout, return_when=asyncio.ALL_COMPLETED)
|
||||||
|
|
||||||
if len(pending) != 0:
|
if len(pending) != 0:
|
||||||
raise asyncio.TimeoutError()
|
raise asyncio.TimeoutError()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user