mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Problem: Arbitrary max_tries in bigchaindb when connecting to tendermint ws (#2241)
* remove max_tries while connecting to tendermint ws Signed-off-by: Shahbaz Nazir <shahbaz@bigchaindb.com> * leave healthcheck as is for now Signed-off-by: Shahbaz Nazir <shahbaz@bigchaindb.com>
This commit is contained in:
parent
651573ef77
commit
9b71026d4b
@ -67,22 +67,19 @@ def subscribe_events(ws, stream_id):
|
||||
|
||||
|
||||
@asyncio.coroutine
|
||||
def try_connect_and_recv(event_queue, max_tries):
|
||||
def try_connect_and_recv(event_queue):
|
||||
try:
|
||||
yield from connect_and_recv(event_queue)
|
||||
|
||||
except Exception as e:
|
||||
if max_tries:
|
||||
logger.warning('WebSocket connection failed with exception %s', e)
|
||||
time.sleep(3)
|
||||
yield from try_connect_and_recv(event_queue, max_tries-1)
|
||||
else:
|
||||
logger.exception('WebSocket connection failed with exception %s', e)
|
||||
logger.warning('WebSocket connection failed with exception %s', e)
|
||||
time.sleep(3)
|
||||
yield from try_connect_and_recv(event_queue)
|
||||
|
||||
|
||||
def start(event_queue):
|
||||
loop = asyncio.get_event_loop()
|
||||
try:
|
||||
loop.run_until_complete(try_connect_and_recv(event_queue, 10))
|
||||
loop.run_until_complete(try_connect_and_recv(event_queue))
|
||||
except (KeyboardInterrupt, SystemExit):
|
||||
logger.info('Shutting down Tendermint event stream connection')
|
||||
|
Loading…
x
Reference in New Issue
Block a user