Don't wait on running_tasks after cancel(). Sometimes a CancelledError exception is received, which is unhelpful, and complicates shutting down the generator.
This commit is contained in:
parent
4767bb9dee
commit
5852fcd287
1 changed files with 0 additions and 2 deletions
|
@ -287,8 +287,6 @@ class IterativeFinder(AsyncGenerator):
|
||||||
running_tasks = list(chain(self.tasks, self.running_probes.values()))
|
running_tasks = list(chain(self.tasks, self.running_probes.values()))
|
||||||
for task in running_tasks:
|
for task in running_tasks:
|
||||||
task.cancel()
|
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",
|
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],
|
type(self).__name__, id(self), self.key.hex()[:8],
|
||||||
reason, len(self.active), len(self.contacted),
|
reason, len(self.active), len(self.contacted),
|
||||||
|
|
Loading…
Reference in a new issue