Try to rework the ugly fix
This commit is contained in:
parent
c78117e356
commit
afaf729df1
2 changed files with 3 additions and 10 deletions
|
@ -376,12 +376,6 @@ public class IobCobCalculatorPlugin extends PluginBase {
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public AutosensData getAutosensData(long time) {
|
public AutosensData getAutosensData(long time) {
|
||||||
return this.getAutosensData(time, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// just a dirty workaround to avoid problems using a too fresh time
|
|
||||||
// should get reworked...
|
|
||||||
private AutosensData getAutosensData(long time, boolean firstCall) {
|
|
||||||
synchronized (dataLock) {
|
synchronized (dataLock) {
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
if (time > now) {
|
if (time > now) {
|
||||||
|
@ -398,9 +392,6 @@ public class IobCobCalculatorPlugin extends PluginBase {
|
||||||
return data;
|
return data;
|
||||||
} else {
|
} else {
|
||||||
// log.debug(">>> getAutosensData Cache miss " + new Date(time).toLocaleString());
|
// log.debug(">>> getAutosensData Cache miss " + new Date(time).toLocaleString());
|
||||||
if (firstCall) {
|
|
||||||
return this.getAutosensData(time - T.mins(5).msecs(), false);
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,9 @@ public class SensitivityOref1Plugin extends AbstractSensitivityPlugin {
|
||||||
return new AutosensResult();
|
return new AutosensResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
AutosensData current = IobCobCalculatorPlugin.getPlugin().getAutosensData(toTime); // this is running inside lock already
|
// the current
|
||||||
|
AutosensData current = IobCobCalculatorPlugin.getPlugin()
|
||||||
|
.getLastAutosensDataSynchronized("SensitivityOref1Plugin"); // this is running inside lock already
|
||||||
if (current == null) {
|
if (current == null) {
|
||||||
log.debug("No current autosens data available");
|
log.debug("No current autosens data available");
|
||||||
return new AutosensResult();
|
return new AutosensResult();
|
||||||
|
|
Loading…
Reference in a new issue