From c7035be2fc5d06001c1fac60728486c298057508 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Sat, 14 May 2022 17:42:03 -0400 Subject: [PATCH] Tolerate double `.remove()`s of stream on portal teardowns --- tractor/_streaming.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tractor/_streaming.py b/tractor/_streaming.py index d45b058..34bc0a1 100644 --- a/tractor/_streaming.py +++ b/tractor/_streaming.py @@ -601,7 +601,14 @@ class Context: finally: if self._portal: - self._portal._streams.remove(rchan) + try: + self._portal._streams.remove(stream) + except KeyError: + log.warning( + f'Stream was already destroyed?\n' + f'actor: {self.chan.uid}\n' + f'ctx id: {self.cid}' + ) async def result(self) -> Any: '''