Skip to content

Commit

Permalink
Merge branch 'hotfix/967' into hotfix/3.1.229
Browse files Browse the repository at this point in the history
  • Loading branch information
alex1702 committed Mar 4, 2024
2 parents 442fc32 + 179152c commit d71634f
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/main/java/mServer/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
import mServer.tool.MserverDatumZeit;
import mServer.tool.MserverLog;

import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;

public class Main {

public Main() {
Expand Down Expand Up @@ -88,11 +91,15 @@ public static void main(String[] args) {
}

private static void runServer(String[] ar) throws InterruptedException {
LocalDateTime beforeRun = LocalDateTime.now().truncatedTo(ChronoUnit.DAYS);
while (new MServer(ar).starten()) {
long timeToSleep = (MserverDatumZeit.getSecondsUntilNextDay() + 120) * 1000; // 0:02
MserverLog.systemMeldung("Schlafenlegen bis zum nächsten Tag (" + timeToSleep + "ms)");
Thread.sleep(timeToSleep);
MserverLog.systemMeldung("Neustart der Suche");
if (!LocalDateTime.now().truncatedTo(ChronoUnit.DAYS).isAfter(beforeRun)) { // do not sleep if day changed
long timeToSleep = (MserverDatumZeit.getSecondsUntilNextDay() + 120) * 1000; // 0:02
MserverLog.systemMeldung("Schlafenlegen bis zum nächsten Tag (" + timeToSleep + "ms)");
Thread.sleep(timeToSleep);
MserverLog.systemMeldung("Neustart der Suche");
}
beforeRun = LocalDateTime.now().truncatedTo(ChronoUnit.DAYS);
}
}

Expand Down

0 comments on commit d71634f

Please sign in to comment.