Verified Commit 8fb586bf authored by Marc Brendecke's avatar Marc Brendecke Committed by Jonathan Haas

Überarbeitung der Delayberechnung

parent 6d639f1b
......@@ -55,6 +55,8 @@ public class TaskScheduler {
private static final ThreadLocal<DateFormat> dateFormat = ThreadLocal.withInitial(() -> new SimpleDateFormat("dd.MM.yyyy HH:mm:ss"));
private static final int ONE_MINUTE = 60 * 1000;
private static final long ONE_HOUR = 60 * ONE_MINUTE;
private static Debug logger;
......@@ -117,13 +119,13 @@ public class TaskScheduler {
/** Startet den Timer, der die Tasks steuert */
public void start() {
// Timer zur nächsten vollen Minute starten
long start = ((System.currentTimeMillis() / 60000) * 60000 + 60000) - System.currentTimeMillis();
long start = ONE_MINUTE - (System.currentTimeMillis() % ONE_MINUTE);
start = start < 100 ? 0 : start;
timer.scheduleAtFixedRate(backupCronTask, start, ONE_MINUTE);
timer.scheduleAtFixedRate(deleteCronTask, start, ONE_MINUTE);
timer.scheduleAtFixedRate(deletePermanentlyCronTask, start, ONE_MINUTE);
timer.scheduleAtFixedRate(requestCronTask, start, ONE_MINUTE);
timer.scheduleAtFixedRate(saveUnsubscriptionTimeTask, start, 60 * ONE_MINUTE);
timer.scheduleAtFixedRate(saveUnsubscriptionTimeTask, start, ONE_HOUR);
}
......@@ -365,11 +367,11 @@ public class TaskScheduler {
if(capacityCheckInterval == 0) {
return "";
}
else if(capacityCheckInterval < (60 * ONE_MINUTE)) {
else if(capacityCheckInterval < ONE_HOUR) {
return (capacityCheckInterval / ONE_MINUTE) + " Minuten";
}
else {
return (capacityCheckInterval / (60 * ONE_MINUTE)) + " Stunden";
return (capacityCheckInterval / ONE_HOUR) + " Stunden";
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment