forked from j62/ctbrec
Remove online check for currently running recordings
For models, which are currently recorded, a online check is not necessary. INstead we can assume, that the model is online and continue with the next one
This commit is contained in:
parent
ca2ceb7f43
commit
e4ab0873bc
|
@ -2,10 +2,14 @@ package ctbrec.recorder;
|
||||||
|
|
||||||
import static ctbrec.Model.State.*;
|
import static ctbrec.Model.State.*;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.io.InterruptedIOException;
|
import java.io.InterruptedIOException;
|
||||||
import java.net.SocketTimeoutException;
|
import java.net.SocketTimeoutException;
|
||||||
|
import java.security.InvalidKeyException;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -52,8 +56,21 @@ public class OnlineMonitor extends Thread {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<Model> activeRecordings = null;
|
||||||
|
try {
|
||||||
|
activeRecordings = recorder.getCurrentlyRecording();
|
||||||
|
} catch (InvalidKeyException | NoSuchAlgorithmException | IllegalStateException | IOException e1) {
|
||||||
|
activeRecordings = Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
// update the currently recorded models
|
// update the currently recorded models
|
||||||
for (Model model : models) {
|
for (Model model : models) {
|
||||||
|
if(activeRecordings.contains(model)) {
|
||||||
|
// ctbrec is recording this model, no need to check the online state
|
||||||
|
EventBusHolder.BUS.post(new ModelIsOnlineEvent(model));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if(model.isOnline(IGNORE_CACHE)) {
|
if(model.isOnline(IGNORE_CACHE)) {
|
||||||
EventBusHolder.BUS.post(new ModelIsOnlineEvent(model));
|
EventBusHolder.BUS.post(new ModelIsOnlineEvent(model));
|
||||||
|
|
Loading…
Reference in New Issue