From 32d0bfcdea295a69696646bc657de998a827b1d2 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Fri, 12 Jul 2024 17:58:54 +0200 Subject: [PATCH] Readd async saveddata io --- .../server/Write-SavedData-IO-async.patch | 23 ++++++------------- 1 file changed, 7 insertions(+), 16 deletions(-) rename patches/{unapplied => }/server/Write-SavedData-IO-async.patch (92%) diff --git a/patches/unapplied/server/Write-SavedData-IO-async.patch b/patches/server/Write-SavedData-IO-async.patch similarity index 92% rename from patches/unapplied/server/Write-SavedData-IO-async.patch rename to patches/server/Write-SavedData-IO-async.patch index cde49336c4..13f5c104c4 100644 --- a/patches/unapplied/server/Write-SavedData-IO-async.patch +++ b/patches/server/Write-SavedData-IO-async.patch @@ -9,15 +9,15 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/sr index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource { +@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon - public void close(boolean save) { // Paper - rewrite chunk system - this.level.chunkTaskScheduler.chunkHolderManager.close(save, true); // Paper - rewrite chunk system + public void close(boolean save) throws IOException { + ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemServerLevel)this.level).moonrise$getChunkTaskScheduler().chunkHolderManager.close(save, true); // Paper - rewrite chunk system + // Paper start - Write SavedData IO async + try { + this.dataStorage.close(); -+ } catch (IOException exception) { -+ LOGGER.error("Failed to close persistent world data", exception); ++ } catch (final IOException e) { ++ LOGGER.error("Failed to close persistent world data", e); + } + // Paper end - Write SavedData IO async } @@ -27,16 +27,7 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/mai index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel { - - try (co.aikar.timings.Timing ignored = this.timings.worldSave.startTiming()) { - if (doFull) { -- this.saveLevelData(); -+ this.saveLevelData(true); // Paper - Write SavedData IO async - } - - this.timings.worldSaveChunks.startTiming(); // Paper -@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. progressListener.progressStartNoAbort(Component.translatable("menu.savingLevel")); } @@ -45,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (progressListener != null) { progressListener.progressStage(Component.translatable("menu.savingChunks")); } -@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. // CraftBukkit end }