Skip to content

Instantly share code, notes, and snippets.

View escline's full-sized avatar

Eric Cline escline

  • Lumen
  • Kansas City
View GitHub Profile
@escline
escline / asyncio_shutdown_loop.py
Last active November 3, 2022 10:38 — forked from nvgoldin/asyncio_shutdown_loop.py
Python 3.6 asyncio - shutdown all tasks safely using signal handler
import signal
import functools
import asyncio
from contextlib import suppress
async def looping_task(loop, task_num):
try:
while True:
print('{0}:in looping_task'.format(task_num))
await asyncio.sleep(5.0, loop=loop)