use asyncio.all_tasks on new pythons

This commit is contained in:
Alexander Bersenev
2020-02-11 19:10:43 +05:00
parent 9c50cab94e
commit f5ee5db86f

View File

@@ -2260,7 +2260,13 @@ def main():
except KeyboardInterrupt:
pass
for task in asyncio.Task.all_tasks():
try:
tasks = asyncio.all_tasks(loop)
except AttributeError:
# for compatibility with python 3.6
tasks = asyncio.Task.all_tasks(loop)
for task in tasks:
task.cancel()
for server in servers: