]> git.basschouten.com Git - openhab-addons.git/commitdiff
Fix Reconnect error race condition (#15536)
authormlobstein <michael.lobstein@gmail.com>
Fri, 1 Sep 2023 21:16:16 +0000 (16:16 -0500)
committerGitHub <noreply@github.com>
Fri, 1 Sep 2023 21:16:16 +0000 (23:16 +0200)
Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com>
bundles/org.openhab.binding.monopriceaudio/src/main/java/org/openhab/binding/monopriceaudio/internal/handler/MonopriceAudioHandler.java

index 2c3a2024a9b7abf49b40d6eec07d4ef3ccafaf8c..d54c259086dc56ce1f88de8fc1715b85f095aaab 100644 (file)
@@ -482,7 +482,6 @@ public class MonopriceAudioHandler extends BaseThingHandler implements Monoprice
                     String error = null;
 
                     if (openConnection()) {
-                        long prevUpdateTime = lastPollingUpdate;
                         // poll all zones on the amplifier to get current state
                         amp.getZoneIds().stream().limit(numZones).forEach((streamZoneId) -> {
                             try {
@@ -505,11 +504,6 @@ public class MonopriceAudioHandler extends BaseThingHandler implements Monoprice
                                 logger.debug("Error sending Xantech periodic update commands: {}", e.getMessage());
                             }
                         }
-
-                        // prevUpdateTime should have changed if a zone update was received
-                        if (lastPollingUpdate == prevUpdateTime) {
-                            error = "@text/offline.communication-error-polling";
-                        }
                     } else {
                         error = "@text/offline.communication-error-reconnection";
                     }
@@ -518,7 +512,6 @@ public class MonopriceAudioHandler extends BaseThingHandler implements Monoprice
                         updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, error);
                     } else {
                         updateStatus(ThingStatus.ONLINE);
-                        lastPollingUpdate = System.currentTimeMillis();
                     }
                 }
             }