fix: deprecation warning in `asyncio.wait
` (#2383)
This commit is contained in:
parent
b8d991420b
commit
bb517ddcca
|
@ -518,8 +518,12 @@ class WebsocketImplProtocol:
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
self.recv_cancel = asyncio.Future()
|
self.recv_cancel = asyncio.Future()
|
||||||
|
tasks = (
|
||||||
|
self.recv_cancel,
|
||||||
|
asyncio.ensure_future(self.assembler.get(timeout)),
|
||||||
|
)
|
||||||
done, pending = await asyncio.wait(
|
done, pending = await asyncio.wait(
|
||||||
(self.recv_cancel, self.assembler.get(timeout)),
|
tasks,
|
||||||
return_when=asyncio.FIRST_COMPLETED,
|
return_when=asyncio.FIRST_COMPLETED,
|
||||||
)
|
)
|
||||||
done_task = next(iter(done))
|
done_task = next(iter(done))
|
||||||
|
@ -570,8 +574,12 @@ class WebsocketImplProtocol:
|
||||||
self.can_pause = False
|
self.can_pause = False
|
||||||
self.recv_cancel = asyncio.Future()
|
self.recv_cancel = asyncio.Future()
|
||||||
while True:
|
while True:
|
||||||
|
tasks = (
|
||||||
|
self.recv_cancel,
|
||||||
|
asyncio.ensure_future(self.assembler.get(timeout=0)),
|
||||||
|
)
|
||||||
done, pending = await asyncio.wait(
|
done, pending = await asyncio.wait(
|
||||||
(self.recv_cancel, self.assembler.get(timeout=0)),
|
tasks,
|
||||||
return_when=asyncio.FIRST_COMPLETED,
|
return_when=asyncio.FIRST_COMPLETED,
|
||||||
)
|
)
|
||||||
done_task = next(iter(done))
|
done_task = next(iter(done))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user