mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
Fix Reconnect error race condition (#15536)
Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com>
This commit is contained in:
parent
e254cb785c
commit
b9a0e6fa14
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user