fix deleting mantle temp files before they are fully written

This commit is contained in:
Julian Krings 2025-06-14 11:16:47 +02:00
parent f32f73e65a
commit 01b62c13b6
No known key found for this signature in database
GPG Key ID: 208C6E08C3B718D2

View File

@ -369,11 +369,10 @@ public class Mantle {
*/
public synchronized void close() {
Iris.debug("Closing The Mantle " + C.DARK_AQUA + dataFolder.getAbsolutePath());
if (closed.get()) {
if (closed.getAndSet(true)) {
return;
}
closed.set(true);
hyperLock.disable();
BurstExecutor b = ioBurst.burst(toUnload.size());
loadedRegions.forEach((i, plate) -> b.queue(() -> {
@ -383,11 +382,11 @@ public class Mantle {
oldFileForRegion(dataFolder, i).delete();
} catch (Throwable e) {
Iris.error("Failed to write Tectonic Plate " + C.DARK_GREEN + Cache.keyX(i) + " " + Cache.keyZ(i));
Iris.reportError(e);
e.printStackTrace();
}
}));
loadedRegions.clear();
IO.delete(new File(dataFolder, ".tmp"));
try {
b.complete();
@ -395,6 +394,7 @@ public class Mantle {
Iris.reportError(e);
}
IO.delete(new File(dataFolder, ".tmp"));
Iris.debug("The Mantle has Closed " + C.DARK_AQUA + dataFolder.getAbsolutePath());
}