Don't disconnect after history read when queue is busy.
Temporary hack, ComboPlugin.runCommand will still run commands synchronously.
This commit is contained in:
parent
aae9f7d153
commit
c5e0eb9968
1 changed files with 23 additions and 12 deletions
|
@ -50,6 +50,7 @@ import info.nightscout.androidaps.plugins.PumpCombo.ruffyscripter.history.Bolus;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffyscripter.history.PumpHistory;
|
import info.nightscout.androidaps.plugins.PumpCombo.ruffyscripter.history.PumpHistory;
|
||||||
import info.nightscout.androidaps.plugins.PumpCombo.ruffyscripter.history.PumpHistoryRequest;
|
import info.nightscout.androidaps.plugins.PumpCombo.ruffyscripter.history.PumpHistoryRequest;
|
||||||
import info.nightscout.androidaps.queue.Callback;
|
import info.nightscout.androidaps.queue.Callback;
|
||||||
|
import info.nightscout.androidaps.queue.CommandQueue;
|
||||||
import info.nightscout.utils.DateUtil;
|
import info.nightscout.utils.DateUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1114,12 +1115,7 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**Reads the pump's history and updates the DB accordingly. */
|
||||||
* Reads the pump's history and updates the DB accordingly.
|
|
||||||
* <p>
|
|
||||||
* Only ever called by #readAllPumpData which is triggered by the user via the combo fragment
|
|
||||||
* which warns the user against doing this.
|
|
||||||
*/
|
|
||||||
private boolean readHistory(@Nullable PumpHistoryRequest request) {
|
private boolean readHistory(@Nullable PumpHistoryRequest request) {
|
||||||
CommandResult historyResult = runCommand(MainApp.gs(R.string.combo_activity_reading_pump_history), 3, () -> ruffyScripter.readHistory(request));
|
CommandResult historyResult = runCommand(MainApp.gs(R.string.combo_activity_reading_pump_history), 3, () -> ruffyScripter.readHistory(request));
|
||||||
if (!historyResult.success) {
|
if (!historyResult.success) {
|
||||||
|
@ -1176,8 +1172,13 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
||||||
readHistory(new PumpHistoryRequest().tddHistory(PumpHistoryRequest.FULL));
|
readHistory(new PumpHistoryRequest().tddHistory(PumpHistoryRequest.FULL));
|
||||||
// }
|
// }
|
||||||
// }, post);
|
// }, post);
|
||||||
post.run();
|
if (post != null) {
|
||||||
ruffyScripter.disconnect();
|
post.run();
|
||||||
|
}
|
||||||
|
CommandQueue commandQueue = ConfigBuilderPlugin.getCommandQueue();
|
||||||
|
if (commandQueue.performing() == null && commandQueue.size() == 0) {
|
||||||
|
ruffyScripter.disconnect();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO use queue once ready
|
// TODO use queue once ready
|
||||||
|
@ -1188,8 +1189,13 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
||||||
readHistory(new PumpHistoryRequest().pumpErrorHistory(PumpHistoryRequest.FULL));
|
readHistory(new PumpHistoryRequest().pumpErrorHistory(PumpHistoryRequest.FULL));
|
||||||
// }
|
// }
|
||||||
// }, post);
|
// }, post);
|
||||||
post.run();
|
if (post != null) {
|
||||||
ruffyScripter.disconnect();
|
post.run();
|
||||||
|
}
|
||||||
|
CommandQueue commandQueue = ConfigBuilderPlugin.getCommandQueue();
|
||||||
|
if (commandQueue.performing() == null && commandQueue.size() == 0) {
|
||||||
|
ruffyScripter.disconnect();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO use queue once ready
|
// TODO use queue once ready
|
||||||
|
@ -1207,8 +1213,13 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
||||||
}
|
}
|
||||||
// }
|
// }
|
||||||
// }, post);
|
// }, post);
|
||||||
post.run();
|
if (post != null) {
|
||||||
ruffyScripter.disconnect();
|
post.run();
|
||||||
|
}
|
||||||
|
CommandQueue commandQueue = ConfigBuilderPlugin.getCommandQueue();
|
||||||
|
if (commandQueue.performing() == null && commandQueue.size() == 0) {
|
||||||
|
ruffyScripter.disconnect();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue