From 5852fcd287dd1d5365036665aecdee12a2751a09 Mon Sep 17 00:00:00 2001 From: Jonathan Moody <103143855+moodyjon@users.noreply.github.com> Date: Mon, 18 Apr 2022 13:51:29 -0400 Subject: [PATCH] Don't wait on running_tasks after cancel(). Sometimes a CancelledError exception is received, which is unhelpful, and complicates shutting down the generator. --- lbry/dht/protocol/iterative_find.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/lbry/dht/protocol/iterative_find.py b/lbry/dht/protocol/iterative_find.py index 6fa179de1..7c7741902 100644 --- a/lbry/dht/protocol/iterative_find.py +++ b/lbry/dht/protocol/iterative_find.py @@ -287,8 +287,6 @@ class IterativeFinder(AsyncGenerator): running_tasks = list(chain(self.tasks, self.running_probes.values())) for task in running_tasks: task.cancel() - if len(running_tasks): - await asyncio.wait(running_tasks, loop=self.loop) log.debug("%s[%x] [%s] async close because %s: %i active nodes %i contacted %i produced %i queued", type(self).__name__, id(self), self.key.hex()[:8], reason, len(self.active), len(self.contacted),