1
0
mirror of https://github.com/bigchaindb/bigchaindb.git synced 2024-06-23 01:36:42 +02: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:
Shahbaz Nazir 2018-04-26 16:50:20 +02:00 committed by Vanshdeep Singh
parent 651573ef77
commit 9b71026d4b

View File

@ -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')