Improve Chunk Prioritization and Internal Scheduler
In previous MC versions, we had a rather simple internal scheduler for delayed tasks that would just keep pushing task back until desired tick was reached. The method it called to schedule the task changed behavior in 1.14, and now this scheduler is not working nowhere near what it was supposed to be doing. This was causing long delayed task to eat up CPU (In Oversleep for example) Rewrite this to just use the CraftScheduler for scheduling delayed tasks. Once this was fixed, it became quite clear the code that delayed ticket additions for chunks based on distance was clearly not right, as it was tested on the previous broken logic. So the ticket delay process has been vastly revamped to be even smarter. Chunks behind the player can load slower than the chunks in front of the player. We also can delay ticket adding until one of its neighbors has loaded, as this lets us get a smoother spiral out for the chunks (minus frustum intent). Additionally on frustum previous commit inadvertently broke frustum trying to fix an issue when the real fix lied elsewhere, so restore chunk priority so it works again.
This commit is contained in:
@@ -9,10 +9,10 @@ One report of a suspected memory leak with the system.
|
||||
This adds additional overhead to asynchronous task dispatching
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
|
||||
index d05a9ae0fbdc8c9d86109a631d059299e51a2a39..8c48130db03e1baffa341222caa6a82b29525671 100644
|
||||
index e68533176a0c07560118531600304fa76a1c3fc6..ff855035ae55df37d68b284ac18976c46d388af2 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
|
||||
@@ -420,7 +420,7 @@ public class CraftScheduler implements BukkitScheduler {
|
||||
@@ -427,7 +427,7 @@ public class CraftScheduler implements BukkitScheduler {
|
||||
}
|
||||
parsePending();
|
||||
} else {
|
||||
@@ -21,7 +21,7 @@ index d05a9ae0fbdc8c9d86109a631d059299e51a2a39..8c48130db03e1baffa341222caa6a82b
|
||||
executor.execute(new ServerSchedulerReportingWrapper(task)); // Paper
|
||||
// We don't need to parse pending
|
||||
// (async tasks must live with race-conditions if they attempt to cancel between these few lines of code)
|
||||
@@ -437,7 +437,7 @@ public class CraftScheduler implements BukkitScheduler {
|
||||
@@ -444,7 +444,7 @@ public class CraftScheduler implements BukkitScheduler {
|
||||
pending.addAll(temp);
|
||||
temp.clear();
|
||||
MinecraftTimings.bukkitSchedulerFinishTimer.stopTiming();
|
||||
@@ -30,7 +30,7 @@ index d05a9ae0fbdc8c9d86109a631d059299e51a2a39..8c48130db03e1baffa341222caa6a82b
|
||||
}
|
||||
|
||||
private void addTask(final CraftTask task) {
|
||||
@@ -497,10 +497,15 @@ public class CraftScheduler implements BukkitScheduler {
|
||||
@@ -504,10 +504,15 @@ public class CraftScheduler implements BukkitScheduler {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
Reference in New Issue
Block a user