Fix NPE on waiting for a region-folder to appear too long

This commit is contained in:
Lukas Rieger (Blue) 2024-06-17 22:52:42 +02:00
parent b086396cd6
commit dbd7414542
No known key found for this signature in database
GPG Key ID: AA33883B1BBA03E6

View File

@ -133,7 +133,8 @@ public static boolean awaitExistence(Path path, long timeout, TimeUnit unit) thr
while (!Files.exists(path)) {
long now = System.currentTimeMillis();
if (now >= endTime) return false;
watchService.poll(endTime - now, TimeUnit.MILLISECONDS).reset();
WatchKey key = watchService.poll(endTime - now, TimeUnit.MILLISECONDS);
if (key != null) key.reset();
}
return true;
}