fix crashes

This commit is contained in:
Andrei Vereha 2022-02-28 22:44:32 +01:00
parent 9ed7b6dd9f
commit 5664805903

View file

@ -122,7 +122,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
createFakeTBRWhenNoActivePod() createFakeTBRWhenNoActivePod()
.subscribeOn(aapsSchedulers.io) .subscribeOn(aapsSchedulers.io)
.doOnError { aapsLogger.warn(LTag.PUMP, "Error on createFakeTBRWhenNoActivePod=$it") } .doOnError { aapsLogger.warn(LTag.PUMP, "Error on createFakeTBRWhenNoActivePod=$it") }
.blockingAwait() .blockingSubscribe()
handler.postDelayed(statusChecker, STATUS_CHECK_INTERVAL_MS) handler.postDelayed(statusChecker, STATUS_CHECK_INTERVAL_MS)
} }
} }
@ -249,7 +249,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
omnipodManager.connect(it).ignoreElements() omnipodManager.connect(it).ignoreElements()
.doOnError { aapsLogger.info(LTag.PUMPCOMM, "connect error=$it") } .doOnError { aapsLogger.info(LTag.PUMPCOMM, "connect error=$it") }
.doOnComplete { podStateManager.incrementSuccessfulConnectionAttemptsAfterRetries() } .doOnComplete { podStateManager.incrementSuccessfulConnectionAttemptsAfterRetries() }
.blockingAwait() .blockingSubscribe()
} }
} finally { } finally {
synchronized(this) { synchronized(this) {
@ -293,7 +293,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
.doOnError { .doOnError {
aapsLogger.error(LTag.PUMP, "Error in getPumpStatus", it) aapsLogger.error(LTag.PUMP, "Error in getPumpStatus", it)
} }
.blockingAwait() .blockingSubscribe()
} }
private fun getPodStatus(): Completable = Completable.concat( private fun getPodStatus(): Completable = Completable.concat(
@ -687,7 +687,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
aapsLogger.debug(LTag.PUMP, "waitForBolusDeliveryToComplete errorGettingStatus=$errorGettingStatus") aapsLogger.debug(LTag.PUMP, "waitForBolusDeliveryToComplete errorGettingStatus=$errorGettingStatus")
Thread.sleep(BOLUS_RETRY_INTERVAL_MS) // retry every 2 sec Thread.sleep(BOLUS_RETRY_INTERVAL_MS) // retry every 2 sec
} }
.blockingAwait() .blockingSubscribe()
} }
if (errorGettingStatus != null) { if (errorGettingStatus != null) {
// requestedBolusAmount will be updated later, via pumpSync // requestedBolusAmount will be updated later, via pumpSync
@ -727,7 +727,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
aapsLogger.debug(LTag.PUMP, "waitForBolusDeliveryToComplete errorGettingStatus=$errorGettingStatus") aapsLogger.debug(LTag.PUMP, "waitForBolusDeliveryToComplete errorGettingStatus=$errorGettingStatus")
Thread.sleep(BOLUS_RETRY_INTERVAL_MS) // retry every 3 sec Thread.sleep(BOLUS_RETRY_INTERVAL_MS) // retry every 3 sec
} }
.blockingAwait() .blockingSubscribe()
if (errorGettingStatus != null) { if (errorGettingStatus != null) {
continue continue
} }