Synchronize modification of list in OmnipodPumpPlugin

This commit is contained in:
Bart Sopers 2020-09-09 23:31:58 +02:00
parent 025f25fb27
commit b474e72a53

View file

@ -462,6 +462,7 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
if (firstRun) { if (firstRun) {
initializeAfterRileyLinkConnection(); initializeAfterRileyLinkConnection();
} else if (!statusRequestList.isEmpty()) { } else if (!statusRequestList.isEmpty()) {
synchronized (statusRequestList) {
Iterator<OmnipodStatusRequestType> iterator = statusRequestList.iterator(); Iterator<OmnipodStatusRequestType> iterator = statusRequestList.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
@ -501,6 +502,7 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
} }
iterator.remove(); iterator.remove();
} }
}
} else if (this.hasTimeDateOrTimeZoneChanged) { } else if (this.hasTimeDateOrTimeZoneChanged) {
PumpEnactResult result = executeCommand(OmnipodCommandType.SET_TIME, aapsOmnipodManager::setTime); PumpEnactResult result = executeCommand(OmnipodCommandType.SET_TIME, aapsOmnipodManager::setTime);
@ -830,8 +832,10 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
} }
public void addPodStatusRequest(OmnipodStatusRequestType pumpStatusRequest) { public void addPodStatusRequest(OmnipodStatusRequestType pumpStatusRequest) {
synchronized (statusRequestList) {
statusRequestList.add(pumpStatusRequest); statusRequestList.add(pumpStatusRequest);
} }
}
@Override @Override
public boolean isFakingTempsByExtendedBoluses() { public boolean isFakingTempsByExtendedBoluses() {