Skip to content

Commit

Permalink
Added gateway is connected check
Browse files Browse the repository at this point in the history
  • Loading branch information
samson0v committed Mar 18, 2024
1 parent 89d8e60 commit b3bdee5
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -583,18 +583,18 @@ def _apply_connection_config(self, config) -> bool:
self._gateway.tb_client.disconnect()
self._gateway.tb_client.stop()

while self._gateway.tb_client.client.is_connected():
while not self._gateway.stopped and self._gateway.tb_client.client.is_connected():
sleep(1)

apply_start = time()

connection_state = False
use_new_config = True
while not connection_state:
while not self._gateway.stopped and not connection_state:
self._gateway.__subscribed_to_rpc_topics = False
new_tb_client = TBClient(config if use_new_config else old_tb_client_config, old_tb_client_config_path, connection_logger)
new_tb_client.connect()
while time() - apply_start <= 30 and not connection_state:
while not self._gateway.stopped and time() - apply_start <= 30 and not connection_state:
connection_state = new_tb_client.is_connected()
sleep(.1)

Expand All @@ -606,7 +606,7 @@ def _apply_connection_config(self, config) -> bool:
else:
new_tb_client.disconnect()
new_tb_client.stop()
while new_tb_client.client.is_connected():
while not self._gateway.stopped and new_tb_client.client.is_connected():
sleep(1)
apply_start = time() * 1000
use_new_config = not use_new_config
Expand Down

0 comments on commit b3bdee5

Please sign in to comment.