Don't check task exceptions ourselves
This commit is contained in:
parent
fa84b0f54b
commit
8d3f98d3fd
@ -46,19 +46,9 @@ class Tasks(object):
|
||||
'''Run a function in a separate thread, and await its completion.'''
|
||||
return await self.loop.run_in_executor(None, func, *args)
|
||||
|
||||
def create_task(self, coro, callback=None):
|
||||
def create_task(self, coro):
|
||||
'''Schedule the coro to be run.'''
|
||||
task = self.tasks.create_task(coro)
|
||||
task.add_done_callback(callback or self._check_task_exception)
|
||||
return task
|
||||
|
||||
def _check_task_exception(self, task):
|
||||
'''Check a task for exceptions.'''
|
||||
try:
|
||||
if not task.cancelled():
|
||||
task.result()
|
||||
except Exception as e:
|
||||
self.logger.exception(f'uncaught task exception: {e}')
|
||||
return self.tasks.create_task(coro)
|
||||
|
||||
async def cancel_all(self, wait=True):
|
||||
'''Cancels all tasks and waits for them to complete.'''
|
||||
|
||||
Loading…
Reference in New Issue
Block a user