Use asyncio.all_tasks instead of deprecated method for Python 3.9 compatibility.

pull/1843/head
Karthikeyan Singaravelan 4 years ago
parent a3ee1d9ee6
commit 603683e2c5

@ -137,7 +137,12 @@ class WebServer:
if PortManager.instance().udp_ports:
log.warning("UDP ports are still used {}".format(PortManager.instance().udp_ports))
for task in asyncio.Task.all_tasks():
try:
tasks = asyncio.all_tasks()
except AttributeError:
tasks = asyncio.Task.all_tasks()
for task in tasks:
task.cancel()
try:
await asyncio.wait_for(task, 1)

Loading…
Cancel
Save