This repository was archived by the owner on May 17, 2021. It is now read-only.
Nest-Binding: Suppress occasionally failing update echo cancellations. #2930
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This code change attempts to suppress rare cases where an attempt to cancel an update echo fails. An update echo is when the
execute()method polls the Nest API and sends updates on the event bus for bound items. The binding'sinternalReceiveUpdatemethod, which is intended to handle updates from all other sources, consults a dynamic list of events to ignore and upon finding and removing a matching event, does not forward the update back to the Nest API. In rare cases and as yet unexplained, the echo cancellation fails and the binding sends the update back to the Nest API.This code change employs two approaches to suppress this behaviour:
itemNameand string version of the newStateas previously, it placesUpdateobjects on the list, which are comprised of theitemNameand thestate. TheUpdateclass'sequalsmethod is used by the list'sremovemethod to find and remove the first matching update. PreviouslyString.equalswas used, but appeared to be occasionally failing for as yet unknown reasons.Note: This PR only attempts to work around the issue of unsuppressed echoes. My working theory, lacking other insight, is some kind of JVM bug. Please test this PR extensively before I merge it (and I will continue to test it), but hopefully some kind of fix or workaround can make it into openHAB 1.7.1.