From d61998a5196f8655e4a9303e19cf233b9d096b3f Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Tue, 30 Oct 2018 16:53:31 +0100 Subject: recursive: Actually stop the grab when canceled This change was lost during the merge of 958563a3602780b48599c27acf212139c2e6904d. --- crocoite/controller.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crocoite/controller.py b/crocoite/controller.py index dd39c1d..fc5b62b 100644 --- a/crocoite/controller.py +++ b/crocoite/controller.py @@ -386,7 +386,7 @@ class RecursiveController: self.have = set () self.pending = set ([self.url]) - while self.pending: + while self.pending and not self._quit: # since pending is a set this picks a random item, which is fine u = self.pending.pop () self.have.add (u) @@ -400,5 +400,7 @@ class RecursiveController: return_when=asyncio.FIRST_COMPLETED) self.running.difference_update (done) + done = asyncio.gather (*self.running) + self.running = set () log () -- cgit v1.2.3