moved sleep function
This commit is contained in:
@@ -111,3 +111,10 @@ class AppDaemonRunContext:
|
||||
return await asyncio.wait_for(coro, timeout)
|
||||
except asyncio.TimeoutError:
|
||||
print('Timed out')
|
||||
|
||||
async def sleep(self, delay: float):
|
||||
"""Wrapper function for asyncio.sleep that suppresses and logs a task cancellation"""
|
||||
try:
|
||||
await self.run_in_executor(self.stop_event.wait, delay)
|
||||
except asyncio.CancelledError:
|
||||
logger.debug('Cancelled during sleep')
|
||||
|
||||
Reference in New Issue
Block a user