Force refresh every 15 min (previously 30).

This commit is contained in:
Johannes Mockenhaupt 2017-10-25 18:20:38 +02:00
parent 22bac709fb
commit d907a1b6b3
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -40,7 +40,7 @@ public class KeepAliveReceiver extends BroadcastReceiver {
boolean isStatusOutdated = false; boolean isStatusOutdated = false;
Date lastConnection = pump.lastDataTime(); Date lastConnection = pump.lastDataTime();
if (lastConnection.getTime() + 30 * 60 * 1000L < System.currentTimeMillis()) if (lastConnection.getTime() + 15 * 60 * 1000L < System.currentTimeMillis())
isStatusOutdated = true; isStatusOutdated = true;
if (Math.abs(profile.getBasal() - pump.getBaseBasalRate()) > pump.getPumpDescription().basalStep) if (Math.abs(profile.getBasal() - pump.getBaseBasalRate()) > pump.getPumpDescription().basalStep)
isBasalOutdated = true; isBasalOutdated = true;
@ -52,7 +52,7 @@ public class KeepAliveReceiver extends BroadcastReceiver {
public void run() { public void run() {
pump.setNewBasalProfile(profile); pump.setNewBasalProfile(profile);
} }
}); }, "pump-refresh");
t.start(); t.start();
} else if (isStatusOutdated && !pump.isBusy()) { } else if (isStatusOutdated && !pump.isBusy()) {
Thread t = new Thread(new Runnable() { Thread t = new Thread(new Runnable() {
@ -60,7 +60,7 @@ public class KeepAliveReceiver extends BroadcastReceiver {
public void run() { public void run() {
pump.refreshDataFromPump("KeepAlive. Status outdated."); pump.refreshDataFromPump("KeepAlive. Status outdated.");
} }
}); }, "pump-refresh");
t.start(); t.start();
} else if (isBasalOutdated && !pump.isBusy()) { } else if (isBasalOutdated && !pump.isBusy()) {
Thread t = new Thread(new Runnable() { Thread t = new Thread(new Runnable() {
@ -68,7 +68,7 @@ public class KeepAliveReceiver extends BroadcastReceiver {
public void run() { public void run() {
pump.refreshDataFromPump("KeepAlive. Basal outdated."); pump.refreshDataFromPump("KeepAlive. Basal outdated.");
} }
}); }, "pump-refresh");
t.start(); t.start();
} }
} }