From 8d3f98d3fd96fd416364a55d74226a2d7d5616e3 Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Wed, 25 Jul 2018 10:32:59 +0800 Subject: [PATCH] Don't check task exceptions ourselves --- electrumx/lib/tasks.py | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/electrumx/lib/tasks.py b/electrumx/lib/tasks.py index 2ed73c5..b122226 100644 --- a/electrumx/lib/tasks.py +++ b/electrumx/lib/tasks.py @@ -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.'''