lowest priority for background calculations
This commit is contained in:
parent
23e37a8be7
commit
620c56e4cb
1 changed files with 6 additions and 5 deletions
|
@ -2,6 +2,7 @@ package info.nightscout.androidaps.plugins.IobCobCalculator;
|
||||||
|
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.HandlerThread;
|
import android.os.HandlerThread;
|
||||||
|
import android.os.Process;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v4.util.LongSparseArray;
|
import android.support.v4.util.LongSparseArray;
|
||||||
|
|
||||||
|
@ -134,7 +135,7 @@ public class IobCobCalculatorPlugin implements PluginBase {
|
||||||
IobCobCalculatorPlugin() {
|
IobCobCalculatorPlugin() {
|
||||||
MainApp.bus().register(this);
|
MainApp.bus().register(this);
|
||||||
if (sHandlerThread == null) {
|
if (sHandlerThread == null) {
|
||||||
sHandlerThread = new HandlerThread(IobCobCalculatorPlugin.class.getSimpleName());
|
sHandlerThread = new HandlerThread(IobCobCalculatorPlugin.class.getSimpleName(), Process.THREAD_PRIORITY_LOWEST);
|
||||||
sHandlerThread.start();
|
sHandlerThread.start();
|
||||||
sHandler = new Handler(sHandlerThread.getLooper());
|
sHandler = new Handler(sHandlerThread.getLooper());
|
||||||
}
|
}
|
||||||
|
@ -232,7 +233,7 @@ public class IobCobCalculatorPlugin implements PluginBase {
|
||||||
private BgReading findOlder(long time) {
|
private BgReading findOlder(long time) {
|
||||||
BgReading lastFound = bgReadings.get(bgReadings.size() - 1);
|
BgReading lastFound = bgReadings.get(bgReadings.size() - 1);
|
||||||
if (lastFound.date > time) return null;
|
if (lastFound.date > time) return null;
|
||||||
for (int i = bgReadings.size() - 2; i >=0 ; --i) {
|
for (int i = bgReadings.size() - 2; i >= 0; --i) {
|
||||||
if (bgReadings.get(i).date < time) continue;
|
if (bgReadings.get(i).date < time) continue;
|
||||||
lastFound = bgReadings.get(i);
|
lastFound = bgReadings.get(i);
|
||||||
if (bgReadings.get(i).date > time) break;
|
if (bgReadings.get(i).date > time) break;
|
||||||
|
|
Loading…
Reference in a new issue