From 11e64426f680b9239cadf96dbf553664e0cb344a Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Wed, 15 Dec 2021 16:20:57 -0500 Subject: [PATCH] Wake all sleeping consumers on bcaster closure --- tractor/trionics/_broadcast.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tractor/trionics/_broadcast.py b/tractor/trionics/_broadcast.py index 35711b2..77ab6d0 100644 --- a/tractor/trionics/_broadcast.py +++ b/tractor/trionics/_broadcast.py @@ -331,10 +331,16 @@ class BroadcastReceiver(ReceiveChannel): if self._closed: return + # if there are sleeping consumers wake + # them on closure. + rr = self._state.recv_ready + if rr: + _, event = rr + event.set() + # XXX: leaving it like this consumers can still get values # up to the last received that still reside in the queue. self._state.subs.pop(self.key) - self._closed = True