tUnsubscribe keys on stop concurrently. - obelisk - Electrum server using libbitcoin as its backend
HTML git clone https://git.parazyd.org/obelisk
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit 3f21b87c39f9ac56e7094ea734765e20fb129ebb
DIR parent 3fb0bfc4504cf87acf959a1e46052be40fd1a6ef
HTML 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(-)
---
DIR diff --git a/electrumobelisk/protocol.py b/electrumobelisk/protocol.py
t@@ -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 = []