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

[openthermgateway] fix automatic reconnect after connection attempt fails #9965

Merged
merged 3 commits into from Jan 27, 2021

Conversation

ArjenKorevaar
Copy link
Member

Fixes #9903

Also see previously closed PR #9925

Signed-off-by: Arjen Korevaar a.korevaar@mephix.com

Signed-off-by: Arjen Korevaar <a.korevaar@mephix.com>
Signed-off-by: Arjen Korevaar <a.korevaar@mephix.com>
}, conf.connectionRetryInterval, TimeUnit.SECONDS);
if (!explicitDisconnect && conf != null && conf.connectionRetryInterval > 0) {
logger.debug("Scheduling to reconnect in {} seconds.", conf.connectionRetryInterval);
scheduler.schedule(this::connect, conf.connectionRetryInterval, TimeUnit.SECONDS);
Copy link
Member

Choose a reason for hiding this comment

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

A binding must not execute any task if it has been disposed. So, this task needs to be cancelled in dispose().

Copy link
Member Author

Choose a reason for hiding this comment

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

Added cancelling task on dispose

Signed-off-by: Arjen Korevaar <a.korevaar@mephix.com>
Copy link
Member

@fwolter fwolter left a comment

Choose a reason for hiding this comment

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

LGTM

@fwolter fwolter merged commit 5a7be93 into openhab:main Jan 27, 2021
@fwolter fwolter added this to the 3.1 milestone Jan 27, 2021
@openhab-bot
Copy link
Collaborator

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/opentherm-gateway-binding/39160/204

@openhab-bot
Copy link
Collaborator

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/opentherm-gateway-binding/39160/206

@ArjenKorevaar ArjenKorevaar deleted the bugfix/9903 branch February 2, 2021 19:27
lsiepel added a commit to lsiepel/openhab-addons that referenced this pull request Feb 9, 2021
themillhousegroup pushed a commit to themillhousegroup/openhab2-addons that referenced this pull request May 10, 2021
…ails (openhab#9965)

* Added callback to disconnected() when connection attempt fails

Signed-off-by: Arjen Korevaar <a.korevaar@mephix.com>

* Updated version number

Signed-off-by: Arjen Korevaar <a.korevaar@mephix.com>

* Cancel reconnect task when disposing

Signed-off-by: Arjen Korevaar <a.korevaar@mephix.com>
Signed-off-by: John Marshall <john.marshall.au@gmail.com>
thinkingstone pushed a commit to thinkingstone/openhab-addons that referenced this pull request Nov 7, 2021
…ails (openhab#9965)

* Added callback to disconnected() when connection attempt fails

Signed-off-by: Arjen Korevaar <a.korevaar@mephix.com>

* Updated version number

Signed-off-by: Arjen Korevaar <a.korevaar@mephix.com>

* Cancel reconnect task when disposing

Signed-off-by: Arjen Korevaar <a.korevaar@mephix.com>
marcfischerboschio pushed a commit to bosch-io/openhab-addons that referenced this pull request May 5, 2022
…ails (openhab#9965)

* Added callback to disconnected() when connection attempt fails

Signed-off-by: Arjen Korevaar <a.korevaar@mephix.com>

* Updated version number

Signed-off-by: Arjen Korevaar <a.korevaar@mephix.com>

* Cancel reconnect task when disposing

Signed-off-by: Arjen Korevaar <a.korevaar@mephix.com>
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.

[openthermgateway] binding doesn't automatically reconnect if connection with the gateway is lost
3 participants