From 6eab3ce464e9ff79e4192de4f1c778d3ef89379b Mon Sep 17 00:00:00 2001 From: Matthew Rocklin Date: Tue, 21 Jul 2020 08:05:06 -0700 Subject: [PATCH] Iterate over list of comms (#3959) Previously this list could change during iteration --- distributed/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distributed/core.py b/distributed/core.py index 250ea076e0..16c611142f 100644 --- a/distributed/core.py +++ b/distributed/core.py @@ -606,7 +606,7 @@ def close(self): break else: yield asyncio.sleep(0.05) - yield [comm.close() for comm in self._comms] # then forcefully close + yield [comm.close() for comm in list(self._comms)] # then forcefully close for cb in self._ongoing_coroutines: cb.cancel() for i in range(10):