]> git.basschouten.com Git - openhab-addons.git/commitdiff
[bluetooth.airthings] Catch all exceptions in a scheduled task to prevent future...
authorPawel <36118444+s-pw@users.noreply.github.com>
Wed, 16 Feb 2022 06:30:39 +0000 (22:30 -0800)
committerGitHub <noreply@github.com>
Wed, 16 Feb 2022 06:30:39 +0000 (07:30 +0100)
* Fixes #9862

Catch all exceptions in scheduled task to prevent future executions from being suppressed.

Signed-off-by: Pawel Switalski <switalski.pw@gmail.com>
Signed-off-by: Pawel <s-pw@example.com>
bundles/org.openhab.binding.bluetooth.airthings/src/main/java/org/openhab/binding/bluetooth/airthings/internal/AbstractAirthingsHandler.java

index 4d3d89c3de1f4738d4c8d3d079890e71d0e21912..464e99fcb407d4aa44cf48cba28d69fa0bcffc9c 100644 (file)
@@ -106,8 +106,12 @@ abstract public class AbstractAirthingsHandler extends BeaconBluetoothHandler {
     }
 
     private void executePeridioc() {
-        sinceLastReadSec.addAndGet(CHECK_PERIOD_SEC);
-        execute();
+        try {
+            sinceLastReadSec.addAndGet(CHECK_PERIOD_SEC);
+            execute();
+        } catch (Exception e) { // catch all to avoid scheduleWithFixedDelay being suppressed
+            logger.warn("Failed to read Airthings device", e);
+        }
     }
 
     private synchronized void execute() {