Fix: prevent DB access on main thread for PumpSyncImplementation.expectedPumpState()
This commit is contained in:
parent
67c53b412d
commit
b5962ab07a
1 changed files with 9 additions and 7 deletions
|
@ -77,7 +77,7 @@ class PumpSyncImplementation @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun expectedPumpState(): PumpSync.PumpState {
|
override fun expectedPumpState(): PumpSync.PumpState {
|
||||||
val bolus = repository.getLastBolusRecord()
|
val bolus = repository.getLastBolusRecordWrapped().blockingGet();
|
||||||
val temporaryBasal = repository.getTemporaryBasalActiveAt(dateUtil.now()).blockingGet()
|
val temporaryBasal = repository.getTemporaryBasalActiveAt(dateUtil.now()).blockingGet()
|
||||||
val extendedBolus = repository.getExtendedBolusActiveAt(dateUtil.now()).blockingGet()
|
val extendedBolus = repository.getExtendedBolusActiveAt(dateUtil.now()).blockingGet()
|
||||||
|
|
||||||
|
@ -104,12 +104,14 @@ class PumpSyncImplementation @Inject constructor(
|
||||||
)
|
)
|
||||||
else null,
|
else null,
|
||||||
bolus =
|
bolus =
|
||||||
bolus?.let {
|
if (bolus is ValueWrapper.Existing)
|
||||||
PumpSync.PumpState.Bolus(
|
bolus.value.let {
|
||||||
timestamp = bolus.timestamp,
|
PumpSync.PumpState.Bolus(
|
||||||
amount = bolus.amount
|
timestamp = bolus.value.timestamp,
|
||||||
)
|
amount = bolus.value.amount
|
||||||
},
|
)
|
||||||
|
}
|
||||||
|
else null,
|
||||||
profile = profileFunction.getProfile()
|
profile = profileFunction.getProfile()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue