Fix priority scheduling logic

This resolves sync loads not being properly prioritised.
This commit is contained in:
Spottedleaf 2024-07-17 07:39:30 -07:00
parent ceeb8c14ee
commit 05ed6a6ff5

View file

@ -11627,7 +11627,7 @@ index 0000000000000000000000000000000000000000..c1c119e2e788d5963de3a74a6b9724c7
+}
diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/NewChunkHolder.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/NewChunkHolder.java
new file mode 100644
index 0000000000000000000000000000000000000000..d5fc5756ea960096ff23376a6b7ac68a2a462d22
index 0000000000000000000000000000000000000000..a7ada64a78e36642a6d5ce4a767bff12e675bb16
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/NewChunkHolder.java
@@ -0,0 +1,2034 @@
@ -12165,7 +12165,7 @@ index 0000000000000000000000000000000000000000..d5fc5756ea960096ff23376a6b7ac68a
+ return us == null ? dfl : us;
+ }
+ if (us == null) {
+ return dfl;
+ return neighbour;
+ }
+
+ return PrioritisedExecutor.Priority.max(us, neighbour);
@ -12211,7 +12211,7 @@ index 0000000000000000000000000000000000000000..d5fc5756ea960096ff23376a6b7ac68a
+
+ // must hold scheduling lock
+ public void raisePriority(final PrioritisedExecutor.Priority priority) {
+ if (this.priority == null || this.priority.isHigherOrEqualPriority(priority)) {
+ if (this.priority != null && this.priority.isHigherOrEqualPriority(priority)) {
+ return;
+ }
+ this.setPriority(priority);
@ -12242,7 +12242,7 @@ index 0000000000000000000000000000000000000000..d5fc5756ea960096ff23376a6b7ac68a
+
+ // must hold scheduling lock
+ public void lowerPriority(final PrioritisedExecutor.Priority priority) {
+ if (this.priority == null || this.priority.isLowerOrEqualPriority(priority)) {
+ if (this.priority != null && this.priority.isLowerOrEqualPriority(priority)) {
+ return;
+ }
+ this.setPriority(priority);
@ -25570,7 +25570,7 @@ index 0000000000000000000000000000000000000000..85950a1aa732ab8c01ad28bec9e0de14
+ }
+}
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
index 2a5453707bc172d8d0efe3f11959cb0b5f830984..b8499c1cea97a1a88a53053bc7da132f2fd3928d 100644
index 5160dc617cc5037cd3f10479454159f2a9984169..379452394679c466a09441d4c12882d0d00d9ef3 100644
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -29,6 +29,45 @@ public class GlobalConfiguration extends ConfigurationPart {