utils: update some logging levels
This commit is contained in:
@@ -97,14 +97,14 @@ async def wait_for_task(task: asyncio.Task, timeout: Optional[float] = None):
|
|||||||
except asyncio.TimeoutError:
|
except asyncio.TimeoutError:
|
||||||
logger.warning(f"{name}: timed out waiting for task to finish")
|
logger.warning(f"{name}: timed out waiting for task to finish")
|
||||||
except asyncio.CancelledError:
|
except asyncio.CancelledError:
|
||||||
logger.error(f"{name}: unexpected task cancellation")
|
logger.trace(f"{name}: unexpected task cancellation (maybe Ctrl-C?)")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.exception(f"{name}: unexpected exception while stopping task: {e}")
|
logger.exception(f"{name}: unexpected exception while stopping task: {e}")
|
||||||
finally:
|
finally:
|
||||||
try:
|
try:
|
||||||
_TASKS.remove(task)
|
_TASKS.remove(task)
|
||||||
except KeyError as e:
|
except KeyError as e:
|
||||||
logger.error(f"{name}: error removing task (already removed?): {e}")
|
logger.trace(f"{name}: unable to remove task (already removed?): {e}")
|
||||||
|
|
||||||
|
|
||||||
async def cancel_task(task: asyncio.Task, timeout: Optional[float] = None):
|
async def cancel_task(task: asyncio.Task, timeout: Optional[float] = None):
|
||||||
@@ -137,7 +137,7 @@ async def cancel_task(task: asyncio.Task, timeout: Optional[float] = None):
|
|||||||
try:
|
try:
|
||||||
_TASKS.remove(task)
|
_TASKS.remove(task)
|
||||||
except KeyError as e:
|
except KeyError as e:
|
||||||
logger.error(f"{name}: error removing task (already removed?): {e}")
|
logger.trace(f"{name}: unable to remove task (already removed?): {e}")
|
||||||
|
|
||||||
|
|
||||||
def current_tasks() -> Set[asyncio.Task]:
|
def current_tasks() -> Set[asyncio.Task]:
|
||||||
|
|||||||
Reference in New Issue
Block a user