From 84867247bcdc6bc1267903060d617ebf2aa28ba8 Mon Sep 17 00:00:00 2001 From: Andrei Vereha Date: Mon, 28 Feb 2022 22:52:57 +0100 Subject: [PATCH] fix retry --- .../pump/omnipod/dash/OmnipodDashPumpPlugin.kt | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/OmnipodDashPumpPlugin.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/OmnipodDashPumpPlugin.kt index d8f6be6c0f..9d241293fb 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/OmnipodDashPumpPlugin.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/OmnipodDashPumpPlugin.kt @@ -681,13 +681,14 @@ class OmnipodDashPumpPlugin @Inject constructor( if (bolusCanceled && podStateManager.activeCommand != null) { var errorGettingStatus: Throwable? = null for (tries in 1..BOLUS_RETRIES) { - getPodStatus() - .doOnError { - errorGettingStatus = it - aapsLogger.debug(LTag.PUMP, "waitForBolusDeliveryToComplete errorGettingStatus=$errorGettingStatus") - Thread.sleep(BOLUS_RETRY_INTERVAL_MS) // retry every 2 sec - } - .blockingSubscribe() + try { + getPodStatus().blockingAwait() + break + } catch (err: Throwable) { + errorGettingStatus = err + aapsLogger.debug(LTag.PUMP, "waitForBolusDeliveryToComplete errorGettingStatus=$errorGettingStatus") + Thread.sleep(BOLUS_RETRY_INTERVAL_MS) // retry every 2 sec + } } if (errorGettingStatus != null) { // requestedBolusAmount will be updated later, via pumpSync