From 749158b97a1516f5816211385ab9cd288d6e13bc Mon Sep 17 00:00:00 2001 From: JustAnotherArchivist Date: Sat, 11 Jul 2020 02:44:48 +0000 Subject: [PATCH] Use the Future's result directly rather than awaiting again The asyncio documentation does not specify whether awaiting a Future multiple times is supported or not: https://bugs.python.org/issue41275 --- qwarc/__init__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/qwarc/__init__.py b/qwarc/__init__.py index 261bd14..c998f98 100644 --- a/qwarc/__init__.py +++ b/qwarc/__init__.py @@ -248,9 +248,8 @@ class QWARC: self._sleepTasks.remove(future) elif future.taskType == 'process': item = future.item - # TODO Replace all of this with `if future.cancelled():` try: - await future #TODO: Is this actually necessary? asyncio.wait only returns 'done' futures... + future.result() except concurrent.futures.CancelledError as e: # Got cancelled, nothing we can do about it, but let's log a warning if it's a process task if future.taskType == 'process':