commit 3f21b87c39f9ac56e7094ea734765e20fb129ebb parent 3fb0bfc4504cf87acf959a1e46052be40fd1a6ef Author: parazyd <parazyd@dyne.org> Date: Fri, 9 Apr 2021 13:04:28 +0200 Unsubscribe keys on stop concurrently. Diffstat:
M | electrumobelisk/protocol.py | | | 4 | +++- |
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/electrumobelisk/protocol.py b/electrumobelisk/protocol.py @@ -115,9 +115,11 @@ class ElectrumProtocol(asyncio.Protocol): # pylint: disable=R0904,R0902 """Destructor function""" self.log.debug("ElectrumProtocol.stop()") if self.bx: + unsub_pool = [] for i in self.sh_subscriptions: self.log.debug("bx.unsubscribe %s", i) - await self.bx.unsubscribe_scripthash(i) + unsub_pool.append(self.bx.unsubscribe_scripthash(i)) + await asyncio.gather(*unsub_pool, return_exceptions=True) await self.bx.stop() # idxs = []