aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSpottedleaf <[email protected]>2022-03-05 17:36:57 -0800
committerSpottedleaf <[email protected]>2022-03-05 17:36:57 -0800
commit1e12cf8db62dde92a4bc79300ef32e0fdc6e50a8 (patch)
treebf5cfbb868fbe81ee45b6c3646b3365beb954c27
parent196271de4e38896c410526dfa9cfa28c041fd7ed (diff)
downloadPaper-1e12cf8db62dde92a4bc79300ef32e0fdc6e50a8.tar.gz
Paper-1e12cf8db62dde92a4bc79300ef32e0fdc6e50a8.zip
Add more to the save fixes
- Set forceTicks to true, so that player packets are always processed so that the main process queue can be drained
-rw-r--r--patches/server/0881-Fix-save-problems-on-shutdown.patch19
1 files changed, 17 insertions, 2 deletions
diff --git a/patches/server/0881-Fix-save-problems-on-shutdown.patch b/patches/server/0881-Fix-save-problems-on-shutdown.patch
index bb39b0fdd8..97b9516f09 100644
--- a/patches/server/0881-Fix-save-problems-on-shutdown.patch
+++ b/patches/server/0881-Fix-save-problems-on-shutdown.patch
@@ -8,9 +8,11 @@ Subject: [PATCH] Fix save problems on shutdown
while waiting for the chunk system to empty, as there's simply
too much trash that could prevent them from executing during
the chunk source tick (i.e "time left in tick" logic).
+- Set forceTicks to true, so that player packets are always
+ processed so that the main process queue can be drained
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
-index 17e87875a95495940899b862eabf98b3d6a365da..e25c9a9ccab67a018c2e58e13b24089bc2ce538f 100644
+index 17e87875a95495940899b862eabf98b3d6a365da..39b7c78b032ed6fc29ac765020d5a38858bf2a3a 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -998,6 +998,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -27,7 +29,7 @@ index 17e87875a95495940899b862eabf98b3d6a365da..e25c9a9ccab67a018c2e58e13b24089b
while (this.levels.values().stream().anyMatch((worldserver1) -> {
return worldserver1.getChunkSource().chunkMap.hasWork();
})) {
-@@ -1010,9 +1017,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
+@@ -1010,9 +1017,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
worldserver.getChunkSource().tick(() -> {
return true;
}, false);
@@ -35,10 +37,23 @@ index 17e87875a95495940899b862eabf98b3d6a365da..e25c9a9ccab67a018c2e58e13b24089b
}
- this.waitUntilNextTick();
++ this.forceTicks = true; // Paper
+ while (this.pollTask()); // Paper - drain tasks
}
this.saveAllChunks(false, true, false);
+@@ -1308,6 +1317,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
+ }
+
+ private boolean haveTime() {
++ // Paper start
++ if (this.forceTicks) {
++ return true;
++ }
++ // Paper end
+ // CraftBukkit start
+ if (isOversleep) return canOversleep();// Paper - because of our changes, this logic is broken
+ return this.forceTicks || this.runningTask() || Util.getMillis() < (this.mayHaveDelayedTasks ? this.delayedTasksMaxNextTickTime : this.nextTickTime);
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index b5b56d4549e97abbbe9e91d881b9bca8428f1eec..dce7452d58d6081f1a83baddafb1596ebd423d21 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java