[config-core] sleep 1s between iterations in watch service loop to free up CPU (wasn't needed that often anyway)
ci/woodpecker/push/docs Pipeline was successful Details
ci/woodpecker/push/jfmod Pipeline failed Details
ci/woodpecker/tag/docs Pipeline was successful Details
ci/woodpecker/tag/jfmod Pipeline was successful Details

This commit is contained in:
Johannes Frohnmeyer 2023-02-23 17:39:15 +01:00
parent a548bba60a
commit 457c1f4d85
Signed by: Johannes
GPG Key ID: E76429612C2929F4
2 changed files with 6 additions and 1 deletions

View File

@ -7,7 +7,7 @@ public abstract class ThreadCoProcess implements CoProcess, Runnable {
public void start() {
if (th != null) stop();
closed = false;
th = new Thread(this);
th = new Thread(this, getClass().getSimpleName());
th.start();
}

View File

@ -49,6 +49,11 @@ public class JfConfigWatchService extends ThreadCoProcess implements Closeable {
@Override
public void executeIteration() {
try {
Thread.sleep(1000);
} catch (InterruptedException ignored) {
return;
}
synchronized (CONFIG_DIR) {
WatchKey key = service.poll();
if (key != null) {