mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-26 16:58:28 +00:00
Merge pull request #1843 from tirkarthi/fix-asyncio-all-tasks-2.2
Use asyncio.all_tasks instead of deprecated method for Python 3.9 compatibility
This commit is contained in:
commit
db47615d43
@ -137,7 +137,12 @@ class WebServer:
|
|||||||
if PortManager.instance().udp_ports:
|
if PortManager.instance().udp_ports:
|
||||||
log.warning("UDP ports are still used {}".format(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()
|
task.cancel()
|
||||||
try:
|
try:
|
||||||
await asyncio.wait_for(task, 1)
|
await asyncio.wait_for(task, 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user