From 69e89459c92bdccbdf416ab5bc0ee9ad9fa9a9aa Mon Sep 17 00:00:00 2001 From: qweeze Date: Thu, 21 Sep 2023 18:54:41 +0400 Subject: [PATCH] fix(client): Fix cleanup of Client._waiters dict --- rstream/client.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/rstream/client.py b/rstream/client.py index 95b401a..e07b86b 100644 --- a/rstream/client.py +++ b/rstream/client.py @@ -198,11 +198,13 @@ async def _listener(self) -> None: break logger.debug("Received frame: %s", frame) - _key = frame.key, frame.corr_id - while self._waiters[_key]: - fut = self._waiters[_key].pop() - fut.set_result(frame) + _key = frame.key, frame.corr_id + waiters = self._waiters.get(_key) + if waiters is not None: + for fut in waiters: + fut.set_result(frame) + del self._waiters[_key] for _, handler in self._handlers.get(frame.__class__, {}).items(): try: