Merge pull request #1397 from avereha/avereha/fix-retry

Avereha/fix retry
This commit is contained in:
Milos Kozak 2022-03-01 09:06:02 +01:00 committed by GitHub
commit 31a9d0b625
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -681,13 +681,14 @@ class OmnipodDashPumpPlugin @Inject constructor(
if (bolusCanceled && podStateManager.activeCommand != null) { if (bolusCanceled && podStateManager.activeCommand != null) {
var errorGettingStatus: Throwable? = null var errorGettingStatus: Throwable? = null
for (tries in 1..BOLUS_RETRIES) { for (tries in 1..BOLUS_RETRIES) {
getPodStatus() try {
.doOnError { getPodStatus().blockingAwait()
errorGettingStatus = it break
aapsLogger.debug(LTag.PUMP, "waitForBolusDeliveryToComplete errorGettingStatus=$errorGettingStatus") } catch (err: Throwable) {
Thread.sleep(BOLUS_RETRY_INTERVAL_MS) // retry every 2 sec errorGettingStatus = err
} aapsLogger.debug(LTag.PUMP, "waitForBolusDeliveryToComplete errorGettingStatus=$errorGettingStatus")
.blockingSubscribe() Thread.sleep(BOLUS_RETRY_INTERVAL_MS) // retry every 2 sec
}
} }
if (errorGettingStatus != null) { if (errorGettingStatus != null) {
// requestedBolusAmount will be updated later, via pumpSync // requestedBolusAmount will be updated later, via pumpSync