mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-07-01 06:02:15 +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:
parent
651573ef77
commit
9b71026d4b
|
@ -67,22 +67,19 @@ def subscribe_events(ws, stream_id):
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def try_connect_and_recv(event_queue, max_tries):
|
def try_connect_and_recv(event_queue):
|
||||||
try:
|
try:
|
||||||
yield from connect_and_recv(event_queue)
|
yield from connect_and_recv(event_queue)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if max_tries:
|
|
||||||
logger.warning('WebSocket connection failed with exception %s', e)
|
logger.warning('WebSocket connection failed with exception %s', e)
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
yield from try_connect_and_recv(event_queue, max_tries-1)
|
yield from try_connect_and_recv(event_queue)
|
||||||
else:
|
|
||||||
logger.exception('WebSocket connection failed with exception %s', e)
|
|
||||||
|
|
||||||
|
|
||||||
def start(event_queue):
|
def start(event_queue):
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
try:
|
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):
|
except (KeyboardInterrupt, SystemExit):
|
||||||
logger.info('Shutting down Tendermint event stream connection')
|
logger.info('Shutting down Tendermint event stream connection')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user