[bluetooth.airthings] Catch all exceptions in a scheduled task to prevent future executions from being suppressed (#12261)

* 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>
This commit is contained in:
Pawel 2022-02-15 22:30:39 -08:00 committed by GitHub
parent baa9aacf50
commit 85866c63c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View 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() {