From a38622f8482e39e1851918bfe2e45609d23069c7 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Wed, 20 Sep 2023 17:28:49 +0200 Subject: [PATCH] fix reloading data --- .../androidaps/workflow/CalculationWorkflowImpl.kt | 6 +++--- .../info/nightscout/implementation/db/CompatDBHelper.kt | 2 +- .../plugins/iob/iobCobCalculator/IobCobCalculatorPlugin.kt | 2 +- .../main/java/info/nightscout/workflow/InvokeLoopWorker.kt | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/workflow/CalculationWorkflowImpl.kt b/app/src/main/java/info/nightscout/androidaps/workflow/CalculationWorkflowImpl.kt index 6d1a364a53..ccca089833 100644 --- a/app/src/main/java/info/nightscout/androidaps/workflow/CalculationWorkflowImpl.kt +++ b/app/src/main/java/info/nightscout/androidaps/workflow/CalculationWorkflowImpl.kt @@ -121,12 +121,12 @@ class CalculationWorkflowImpl @Inject constructor( } 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) val workStatus = WorkManager.getInstance(context).getWorkInfosForUniqueWork(job).get() while (workStatus.size >= 1 && workStatus[0].state == WorkInfo.State.RUNNING) SystemClock.sleep(100) - aapsLogger.debug(LTag.AUTOSENS, "Calculation thread stopped: $from") + aapsLogger.debug(LTag.WORKER, "Calculation thread stopped: $from") } override fun runCalculation( @@ -138,7 +138,7 @@ class CalculationWorkflowImpl @Inject constructor( bgDataReload: Boolean, 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) .beginUniqueWork( diff --git a/implementation/src/main/java/info/nightscout/implementation/db/CompatDBHelper.kt b/implementation/src/main/java/info/nightscout/implementation/db/CompatDBHelper.kt index 22751eca68..bad9684b28 100644 --- a/implementation/src/main/java/info/nightscout/implementation/db/CompatDBHelper.kt +++ b/implementation/src/main/java/info/nightscout/implementation/db/CompatDBHelper.kt @@ -58,7 +58,7 @@ class CompatDBHelper @Inject constructor( */ var newestGlucoseValue: GlucoseValue? = null it.filterIsInstance().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)) newestGlucoseValue = gv } diff --git a/plugins/main/src/main/java/info/nightscout/plugins/iob/iobCobCalculator/IobCobCalculatorPlugin.kt b/plugins/main/src/main/java/info/nightscout/plugins/iob/iobCobCalculator/IobCobCalculatorPlugin.kt index 84df87bdd7..ac0dad3e24 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/iob/iobCobCalculator/IobCobCalculatorPlugin.kt +++ b/plugins/main/src/main/java/info/nightscout/plugins/iob/iobCobCalculator/IobCobCalculatorPlugin.kt @@ -390,7 +390,7 @@ class IobCobCalculatorPlugin @Inject constructor( // prepare task for execution in 1 sec scheduledEvent?.let { // set reload bg data if was not set - if (!event.reloadBgData) event.reloadBgData = it.reloadBgData + event.reloadBgData = event.reloadBgData || it.reloadBgData } scheduledEvent = event scheduledHistoryPost = historyWorker.schedule( diff --git a/workflow/src/main/java/info/nightscout/workflow/InvokeLoopWorker.kt b/workflow/src/main/java/info/nightscout/workflow/InvokeLoopWorker.kt index 742a6f8c08..23fe97a16f 100644 --- a/workflow/src/main/java/info/nightscout/workflow/InvokeLoopWorker.kt +++ b/workflow/src/main/java/info/nightscout/workflow/InvokeLoopWorker.kt @@ -29,7 +29,7 @@ class InvokeLoopWorker( 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 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.

*/ override suspend fun doWorkAndLog(): Result {