catch TimeoutError when attempting to send notifications
This commit is contained in:
parent
74cd887249
commit
dd1de530c3
1 changed files with 13 additions and 2 deletions
|
@ -879,7 +879,12 @@ class LBRYElectrumX(SessionBase):
|
||||||
"""
|
"""
|
||||||
if height_changed and self.subscribe_headers:
|
if height_changed and self.subscribe_headers:
|
||||||
args = (await self.subscribe_headers_result(), )
|
args = (await self.subscribe_headers_result(), )
|
||||||
await self.send_notification('blockchain.headers.subscribe', args)
|
try:
|
||||||
|
await self.send_notification('blockchain.headers.subscribe', args)
|
||||||
|
except asyncio.TimeoutError:
|
||||||
|
self.logger.info("timeout sending headers notification to %s", self.peer_address_str(for_log=True))
|
||||||
|
self.abort()
|
||||||
|
return
|
||||||
|
|
||||||
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):
|
||||||
|
@ -907,7 +912,13 @@ class LBRYElectrumX(SessionBase):
|
||||||
method = 'blockchain.scripthash.subscribe'
|
method = 'blockchain.scripthash.subscribe'
|
||||||
else:
|
else:
|
||||||
method = 'blockchain.address.subscribe'
|
method = 'blockchain.address.subscribe'
|
||||||
await self.send_notification(method, (alias, status))
|
|
||||||
|
try:
|
||||||
|
await self.send_notification(method, (alias, status))
|
||||||
|
except asyncio.TimeoutError:
|
||||||
|
self.logger.info("timeout sending address notification to %s", self.peer_address_str(for_log=True))
|
||||||
|
self.abort()
|
||||||
|
return
|
||||||
|
|
||||||
if changed:
|
if changed:
|
||||||
es = '' if len(changed) == 1 else 'es'
|
es = '' if len(changed) == 1 else 'es'
|
||||||
|
|
Loading…
Reference in a new issue