aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJason Penilla <[email protected]>2024-10-27 14:25:51 -0700
committerJason Penilla <[email protected]>2024-10-27 14:25:51 -0700
commita2d6c26baf3b1736e29ebdda0573c3eb9ca3d689 (patch)
tree33b00d3949d0b0469d2ea3db058e4436019c3d70
parent9e35192360a837e81e669c59e89f1c5c4ab0f2f1 (diff)
downloadPaper-a2d6c26baf3b1736e29ebdda0573c3eb9ca3d689.tar.gz
Paper-a2d6c26baf3b1736e29ebdda0573c3eb9ca3d689.zip
Avoid issues with certain tasks not processing during sleep
Execute processQueue tasks during sleep & unload chunks during sleep
-rw-r--r--patches/server/1055-Avoid-issues-with-certain-tasks-not-processing-durin.patch28
1 files changed, 28 insertions, 0 deletions
diff --git a/patches/server/1055-Avoid-issues-with-certain-tasks-not-processing-durin.patch b/patches/server/1055-Avoid-issues-with-certain-tasks-not-processing-durin.patch
new file mode 100644
index 0000000000..ed38a06210
--- /dev/null
+++ b/patches/server/1055-Avoid-issues-with-certain-tasks-not-processing-durin.patch
@@ -0,0 +1,28 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Jason Penilla <[email protected]>
+Date: Sun, 27 Oct 2024 14:18:28 -0700
+Subject: [PATCH] Avoid issues with certain tasks not processing during sleep
+
+Execute processQueue tasks during sleep & unload chunks during sleep
+
+diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
+index af7c6f56444c0e495fd39da872f8030199afc634..7933d6900dac67a24fb5f9378097dbde34be30b1 100644
+--- a/src/main/java/net/minecraft/server/MinecraftServer.java
++++ b/src/main/java/net/minecraft/server/MinecraftServer.java
+@@ -1639,6 +1639,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
+ }
+
+ this.server.getScheduler().mainThreadHeartbeat(); // CraftBukkit
++ // Paper start - avoid issues with certain tasks not processing during sleep
++ Runnable task;
++ while ((task = this.processQueue.poll()) != null) {
++ task.run();
++ }
++ for (final ServerLevel level : this.levels.values()) {
++ // process unloads
++ level.getChunkSource().tick(() -> true, false);
++ }
++ // Paper end - avoid issues with certain tasks not processing during sleep
+ this.server.spark.executeMainThreadTasks(); // Paper - spark
+ this.tickConnection();
+ this.server.spark.tickEnd(((double)(System.nanoTime() - lastTick) / 1000000D)); // Paper - spark