Paper/patches/server/0736-Fix-chunks-refusing-to-unload-at-low-TPS.patch

27 lines
1.5 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Mon, 1 Feb 2021 15:35:14 -0800
Subject: [PATCH] Fix chunks refusing to unload at low TPS
The full chunk future is appended to the chunk save future, but
when moving to unloaded ticket level it is not being completed with
the empty chunk access, so the chunk save must wait for the full
chunk future to complete. We can simply schedule to the immediate
executor to get this effect, rather than the main mailbox.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
2022-03-01 06:43:03 +01:00
index a93a971dd7e2fbe5e6d9196ca1e95f5f8c3c660e..be8303e64e481e37a6ab25ee99c4008037670303 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
2022-03-01 06:43:03 +01:00
@@ -1315,9 +1315,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
2021-11-25 04:06:43 +01:00
return chunk;
});
- }, (runnable) -> {
2022-03-01 06:43:03 +01:00
- this.mainThreadMailbox.tell(ChunkTaskPriorityQueueSorter.message(holder, () -> ChunkMap.this.chunkLoadConversionCallbackExecutor.execute(runnable))); // Paper - delay running Chunk post processing until outside of the sorter to prevent a deadlock scenario when post processing causes another chunk request.
- });
+ }, this.mainThreadExecutor); // Paper - queue to execute immediately so this doesn't delay chunk unloading
}
public int getTickingGenerated() {