Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed TBClient reconnecting #1337

Merged
merged 2 commits into from
Mar 18, 2024
Merged

Fixed TBClient reconnecting #1337

merged 2 commits into from
Mar 18, 2024

Conversation

samson0v
Copy link
Contributor

No description provided.

@samson0v samson0v linked an issue Mar 15, 2024 that may be closed by this pull request

connection_logger = getLogger('tb_connection')
new_tb_client = TBClient(config, old_tb_client.get_config_folder_path(), connection_logger)
while self._gateway.tb_client.client.is_connected():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This loop can cause the gateway stuck, probably, it will be better to add check is the gateway stopped or no, to avoid hold before stop.


connection_state = False
use_new_config = True
while not connection_state:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add check for gateway status - is it stopped or no.

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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check is gateway running will be nice here as well.

else:
new_tb_client.disconnect()
new_tb_client.stop()
while new_tb_client.client.is_connected():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a check is gateway running or stopped.

@imbeacon imbeacon merged commit e137452 into thingsboard:master Mar 18, 2024
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Connection lost after changing General Configuration
2 participants