async def shutdown(sig, loop):
logging.info(f'<STR_LIT>')<EOL>tasks = [task for task in asyncio.Task.all_tasks() if task is not<EOL>asyncio.tasks.Task.current_task()]<EOL>for task in tasks:<EOL><INDENT>logging.debug(f'<STR_LIT>')<EOL>task.cancel()<EOL><DEDENT>results = await asyncio.gather(*tasks, return_exceptions=True)<EOL>logging.debug(f'<STR_LIT>')<EOL>loop.stop()<EOL>logging.info('<STR_LIT>')<EOL>
Gracefully cancel current tasks when app receives a shutdown signal.