try making sending header notifications faster
This commit is contained in:
parent
ba2e2a1dcc
commit
a5120d772c
1 changed files with 12 additions and 7 deletions
|
@ -221,13 +221,18 @@ class MemPool:
|
||||||
return
|
return
|
||||||
|
|
||||||
if height_changed:
|
if height_changed:
|
||||||
header_tasks = [
|
notified = 0
|
||||||
session.send_notification('blockchain.headers.subscribe', (self.session_manager.hsub_results[session.subscribe_headers_raw], ))
|
for session in self.session_manager.sessions.values():
|
||||||
for session in self.session_manager.sessions.values() if session.subscribe_headers
|
if session.subscribe_headers:
|
||||||
]
|
notified += 1
|
||||||
if header_tasks:
|
asyncio.create_task(
|
||||||
self.logger.info(f'notify {len(header_tasks)} sessions of new header')
|
session.send_notification('blockchain.headers.subscribe',
|
||||||
asyncio.create_task(asyncio.wait(header_tasks))
|
(self.session_manager.hsub_results[session.subscribe_headers_raw], ))
|
||||||
|
)
|
||||||
|
if notified % 10 == 0:
|
||||||
|
await asyncio.sleep(0) # break up the loop somewhat, there can be many headers notifications
|
||||||
|
if notified:
|
||||||
|
self.logger.info(f'queued notify {notified} sessions of new header')
|
||||||
for hashX in touched.intersection(self.session_manager.mempool_statuses.keys()):
|
for hashX in touched.intersection(self.session_manager.mempool_statuses.keys()):
|
||||||
self.session_manager.mempool_statuses.pop(hashX, None)
|
self.session_manager.mempool_statuses.pop(hashX, None)
|
||||||
# self.bp._chain_executor
|
# self.bp._chain_executor
|
||||||
|
|
Loading…
Add table
Reference in a new issue