Skip to content

Commit

Permalink
Don't warning log if nothing is pending after timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
cjrh committed Nov 14, 2022
1 parent 05b8258 commit 8da6fba
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions aiorun.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,16 +363,16 @@ async def wait_for_cancelled_tasks(timeout):
"""
_, pending = await asyncio.wait([*tasks, *do_not_cancel], timeout=timeout)
tasks_info = '\n\n'.join(str(t.get_stack()) for t in pending)
msg = (
"During shutdown, the following tasks were cancelled but refused "
"to exit after {timeout} seconds: {tasks_info}".format(
timeout=timeout,
tasks_info=tasks_info
if pending:
tasks_info = '\n\n'.join(str(t.get_stack()) for t in pending)
msg = (
"During shutdown, the following tasks were cancelled but refused "
"to exit after {timeout} seconds: {tasks_info}".format(
timeout=timeout,
tasks_info=tasks_info
)
)
)

logger.warning(msg)
logger.warning(msg)

if tasks or do_not_cancel:
logger.info("Running pending tasks till complete")
Expand Down

0 comments on commit 8da6fba

Please sign in to comment.