forked from LBRYCommunity/lbry-sdk
fix notify
This commit is contained in:
parent
e22bc01cbd
commit
50ecb0dac9
1 changed files with 9 additions and 2 deletions
|
@ -940,13 +940,21 @@ class LBRYElectrumX(SessionBase):
|
||||||
|
|
||||||
touched = touched.intersection(self.hashX_subs)
|
touched = touched.intersection(self.hashX_subs)
|
||||||
if touched or (height_changed and self.mempool_statuses):
|
if touched or (height_changed and self.mempool_statuses):
|
||||||
|
notified = set()
|
||||||
|
mempool_addrs = tuple(self.mempool_statuses.keys())
|
||||||
for hashX in touched:
|
for hashX in touched:
|
||||||
alias = self.hashX_subs[hashX]
|
alias = self.hashX_subs[hashX]
|
||||||
asyncio.create_task(send_history_notification(alias, hashX))
|
asyncio.create_task(send_history_notification(alias, hashX))
|
||||||
|
notified.add(hashX)
|
||||||
|
for hashX in mempool_addrs:
|
||||||
|
if hashX not in notified:
|
||||||
|
alias = self.hashX_subs[hashX]
|
||||||
|
asyncio.create_task(send_history_notification(alias, hashX))
|
||||||
|
notified.add(hashX)
|
||||||
|
|
||||||
if touched:
|
if touched:
|
||||||
es = '' if len(touched) == 1 else 'es'
|
es = '' if len(touched) == 1 else 'es'
|
||||||
self.logger.info(f'notified of {len(touched):,d} address{es}')
|
self.logger.info(f'notified {len(notified)} mempool/{len(touched):,d} touched address{es}')
|
||||||
|
|
||||||
def get_metrics_or_placeholder_for_api(self, query_name):
|
def get_metrics_or_placeholder_for_api(self, query_name):
|
||||||
""" Do not hold on to a reference to the metrics
|
""" Do not hold on to a reference to the metrics
|
||||||
|
@ -1175,7 +1183,6 @@ class LBRYElectrumX(SessionBase):
|
||||||
self.mempool_statuses[hashX] = status
|
self.mempool_statuses[hashX] = status
|
||||||
else:
|
else:
|
||||||
self.mempool_statuses.pop(hashX, None)
|
self.mempool_statuses.pop(hashX, None)
|
||||||
|
|
||||||
return status
|
return status
|
||||||
|
|
||||||
async def hashX_listunspent(self, hashX):
|
async def hashX_listunspent(self, hashX):
|
||||||
|
|
Loading…
Reference in a new issue