Update cached data in RemoteRecorder so that views update faster
This commit is contained in:
parent
6e5d706f65
commit
0d02a6cf9c
|
@ -100,6 +100,7 @@ public class RecordLaterTab extends AbstractRecordedModelsTab implements TabSele
|
|||
filteredModels.clear();
|
||||
filter(filter.getText());
|
||||
table.sort();
|
||||
table.refresh();
|
||||
}
|
||||
|
||||
private void addOrUpdateModels(List<JavaFxModel> updatedModels) {
|
||||
|
|
|
@ -18,7 +18,6 @@ public abstract class AbstractModelTask {
|
|||
|
||||
public CompletableFuture<Model> executeSync(Model model) {
|
||||
try {
|
||||
org.slf4j.LoggerFactory.getLogger(getClass()).debug("Executing concrete task for {} - suspended:{}", model, model.isSuspended());
|
||||
concreteTask.accept(model);
|
||||
return CompletableFuture.completedFuture(model);
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -103,11 +103,19 @@ public class RemoteRecorder implements Recorder {
|
|||
LOG.trace("Model until: {}", model.getRecordUntil().equals(Instant.ofEpochMilli(Model.RECORD_INDEFINITELY)) ? "no limit" : model.getRecordUntil());
|
||||
LOG.trace("Model after: {}", model.getRecordUntilSubsequentAction());
|
||||
sendRequest("start", model);
|
||||
findModel(model).ifPresent(cachedModel -> {
|
||||
cachedModel.setSuspended(model.isSuspended());
|
||||
cachedModel.setMarkedForLaterRecording(model.isMarkedForLaterRecording());
|
||||
cachedModel.setRecordUntil(model.getRecordUntil());
|
||||
cachedModel.setRecordUntilSubsequentAction(model.getRecordUntilSubsequentAction());
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopRecording(Model model) throws IOException, InvalidKeyException, NoSuchAlgorithmException {
|
||||
sendRequest("stop", model);
|
||||
models.remove(model);
|
||||
onlineModels.remove(model);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -147,13 +155,6 @@ public class RemoteRecorder implements Recorder {
|
|||
if (!resp.status.equals(SUCCESS)) {
|
||||
throw new IOException("Server returned error " + resp.status + " " + resp.msg);
|
||||
}
|
||||
|
||||
if ("start".equals(action)) {
|
||||
models.add(model);
|
||||
} else if ("stop".equals(action)) {
|
||||
models.remove(model);
|
||||
onlineModels.remove(model);
|
||||
}
|
||||
} else {
|
||||
throw new HttpException(response.code(), response.message());
|
||||
}
|
||||
|
@ -733,8 +734,10 @@ public class RemoteRecorder implements Recorder {
|
|||
int index = models.indexOf(model);
|
||||
if (index >= 0) {
|
||||
Model m = models.get(index);
|
||||
if (m.isMarkedForLaterRecording() && !mark) {
|
||||
models.remove(m);
|
||||
}
|
||||
m.setMarkedForLaterRecording(mark);
|
||||
models.remove(index);
|
||||
} else {
|
||||
models.add(model);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue