forked from j62/ctbrec
1
0
Fork 0

Sort models by prio before online check

This commit is contained in:
0xboobface 2020-01-04 15:59:11 +01:00
parent d82c3b490b
commit 242897719b
2 changed files with 7 additions and 3 deletions

View File

@ -3,9 +3,10 @@
* Added recording priorities for models. If you restrict the number of
concurrent downloads, models with high priority will be favored over models
with low prio. Running recordings of models with low prio might even get
stopped, so that models with higher prio can get recorded.
You can adjust the prio on the "Recroding" tab by double-clicking on the
value or by using your scroll wheel while holding down CTRL
stopped, so that models with higher prio can get recorded. Models with
higher priority will also get checked first in the online check loop.
You can adjust the prio on the "Recording" tab by double-clicking on the
value or by using your scroll wheel while holding down CTRL.
* Added menu entry to open the recording dir of a model

View File

@ -6,6 +6,7 @@ import java.io.InterruptedIOException;
import java.net.SocketTimeoutException;
import java.time.Duration;
import java.time.Instant;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
@ -74,6 +75,8 @@ public class OnlineMonitor extends Thread {
}
private void updateModels(List<Model> models) {
// sort models by priority
Collections.sort(models, (a, b) -> b.getPriority() - a.getPriority());
// submit online check jobs to the executor for the model's site
List<Future<?>> futures = new LinkedList<>();
for (Model model : models) {