Fix DeprecationWarning: "@coroutine"

python[11090]: /var/www/yunorunner/./run.py:119: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead

python[11090]:   def wait_closed(self):
This commit is contained in:
yalh76 2021-06-30 02:13:08 +02:00
parent 5572f746ef
commit 6508dcf51d

5
run.py
View file

@ -115,8 +115,7 @@ def datetime_to_epoch_json_converter(o):
return o.strftime('%s')
@asyncio.coroutine
def wait_closed(self):
async def wait_closed(self):
"""
Wait until the connection is closed.
@ -126,7 +125,7 @@ def wait_closed(self):
of its cause, in tasks that interact with the WebSocket connection.
"""
yield from asyncio.shield(self.connection_lost_waiter)
await asyncio.shield(self.connection_lost_waiter)
# this is a backport of websockets 7.0 which sanic doesn't support yet