-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[radiothermostat] Skip shutdown actions if thing offline #16677
Conversation
Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I have added a comment about the framework's expectations towards the dispose
method.
} | ||
if (ThingStatus.ONLINE.equals(this.getThing().getStatus())) { | ||
if (isLinked(REMOTE_TEMP)) { | ||
connector.sendCommand("rem_mode", "0", REMOTE_TEMP_RESOURCE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there is no need to do this when the thing is not online, that helps.
But the real issue is probably this blocking call. dispose
is expected to be non-blocking and to return quickly - see https://www.openhab.org/docs/developer/bindings/#shutdown. So you should probably schedule a job for sending these commands.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha, I have adjusted the code to run the calls within a job.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm now wondering if there is a risk that isLinked
will not work after dispose
returns. I didn't check the implementation (yet), but in such a case, introducing local variables before scheduling the job might help.
Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com>
Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com>
Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com> Signed-off-by: Paul Smedley <paul@smedley.id.au>
Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com> Signed-off-by: Patrik Gfeller <patrik.gfeller@proton.me>
Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com>
Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com>
Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com> Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
Improvement to #15492. Skip shutdown actions if thing is offline to prevent slowness when the binding is disposed.