fix reloading data
This commit is contained in:
parent
355361ed6d
commit
a38622f848
4 changed files with 6 additions and 6 deletions
|
@ -121,12 +121,12 @@ class CalculationWorkflowImpl @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun stopCalculation(job: String, from: String) {
|
override fun stopCalculation(job: String, from: String) {
|
||||||
aapsLogger.debug(LTag.AUTOSENS, "Stopping calculation thread: $from")
|
aapsLogger.debug(LTag.WORKER, "Stopping calculation thread: $from")
|
||||||
WorkManager.getInstance(context).cancelUniqueWork(job)
|
WorkManager.getInstance(context).cancelUniqueWork(job)
|
||||||
val workStatus = WorkManager.getInstance(context).getWorkInfosForUniqueWork(job).get()
|
val workStatus = WorkManager.getInstance(context).getWorkInfosForUniqueWork(job).get()
|
||||||
while (workStatus.size >= 1 && workStatus[0].state == WorkInfo.State.RUNNING)
|
while (workStatus.size >= 1 && workStatus[0].state == WorkInfo.State.RUNNING)
|
||||||
SystemClock.sleep(100)
|
SystemClock.sleep(100)
|
||||||
aapsLogger.debug(LTag.AUTOSENS, "Calculation thread stopped: $from")
|
aapsLogger.debug(LTag.WORKER, "Calculation thread stopped: $from")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun runCalculation(
|
override fun runCalculation(
|
||||||
|
@ -138,7 +138,7 @@ class CalculationWorkflowImpl @Inject constructor(
|
||||||
bgDataReload: Boolean,
|
bgDataReload: Boolean,
|
||||||
cause: Event?
|
cause: Event?
|
||||||
) {
|
) {
|
||||||
aapsLogger.debug(LTag.AUTOSENS, "Starting calculation worker: $reason to ${dateUtil.dateAndTimeAndSecondsString(end)}")
|
aapsLogger.debug(LTag.WORKER, "Starting calculation worker: $reason to ${dateUtil.dateAndTimeAndSecondsString(end)}")
|
||||||
|
|
||||||
WorkManager.getInstance(context)
|
WorkManager.getInstance(context)
|
||||||
.beginUniqueWork(
|
.beginUniqueWork(
|
||||||
|
|
|
@ -58,7 +58,7 @@ class CompatDBHelper @Inject constructor(
|
||||||
*/
|
*/
|
||||||
var newestGlucoseValue: GlucoseValue? = null
|
var newestGlucoseValue: GlucoseValue? = null
|
||||||
it.filterIsInstance<GlucoseValue>().maxByOrNull { gv -> gv.timestamp }?.let { gv ->
|
it.filterIsInstance<GlucoseValue>().maxByOrNull { gv -> gv.timestamp }?.let { gv ->
|
||||||
aapsLogger.debug(LTag.DATABASE, "Firing EventNewBg $gv")
|
aapsLogger.debug(LTag.DATABASE, "Firing EventNewBG $gv")
|
||||||
rxBus.send(EventNewBG(gv.timestamp))
|
rxBus.send(EventNewBG(gv.timestamp))
|
||||||
newestGlucoseValue = gv
|
newestGlucoseValue = gv
|
||||||
}
|
}
|
||||||
|
|
|
@ -390,7 +390,7 @@ class IobCobCalculatorPlugin @Inject constructor(
|
||||||
// prepare task for execution in 1 sec
|
// prepare task for execution in 1 sec
|
||||||
scheduledEvent?.let {
|
scheduledEvent?.let {
|
||||||
// set reload bg data if was not set
|
// set reload bg data if was not set
|
||||||
if (!event.reloadBgData) event.reloadBgData = it.reloadBgData
|
event.reloadBgData = event.reloadBgData || it.reloadBgData
|
||||||
}
|
}
|
||||||
scheduledEvent = event
|
scheduledEvent = event
|
||||||
scheduledHistoryPost = historyWorker.schedule(
|
scheduledHistoryPost = historyWorker.schedule(
|
||||||
|
|
|
@ -29,7 +29,7 @@ class InvokeLoopWorker(
|
||||||
This method is triggered once autosens calculation has completed, so the LoopPlugin
|
This method is triggered once autosens calculation has completed, so the LoopPlugin
|
||||||
has current data to work with. However, autosens calculation can be triggered by multiple
|
has current data to work with. However, autosens calculation can be triggered by multiple
|
||||||
sources and currently only a new BG should trigger a loop run. Hence we return early if
|
sources and currently only a new BG should trigger a loop run. Hence we return early if
|
||||||
the event causing the calculation is not EventNewBg.
|
the event causing the calculation is not EventNewBG.
|
||||||
<p>
|
<p>
|
||||||
*/
|
*/
|
||||||
override suspend fun doWorkAndLog(): Result {
|
override suspend fun doWorkAndLog(): Result {
|
||||||
|
|
Loading…
Reference in a new issue