From 242897719be3c6cf53b9923ec4141206f75ce2c2 Mon Sep 17 00:00:00 2001 From: 0xboobface <0xboobface@gmail.com> Date: Sat, 4 Jan 2020 15:59:11 +0100 Subject: [PATCH] Sort models by prio before online check --- CHANGELOG.md | 7 ++++--- common/src/main/java/ctbrec/recorder/OnlineMonitor.java | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4572a606..171345ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/common/src/main/java/ctbrec/recorder/OnlineMonitor.java b/common/src/main/java/ctbrec/recorder/OnlineMonitor.java index 5aa56d67..e651c05f 100644 --- a/common/src/main/java/ctbrec/recorder/OnlineMonitor.java +++ b/common/src/main/java/ctbrec/recorder/OnlineMonitor.java @@ -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 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> futures = new LinkedList<>(); for (Model model : models) {