-
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Async task handling improvement (#209)
* All threads are core thread * Drop later submitted pathfinding tasks if task before is not started yet * Auto-resize is gone * Refine error handling * Handle rejected execution * Limit size and schedule on EntityScheduler * Allow pr to build * Remove duplicate path handling Since it's a very rare case and Kaiiju has already done something to handle this * Update thread and logger name format * Core pool to 1 * Revert entity scheduler changes * Expose queue size to config * Add reject policy config to pathfinding * [ci/skip] To uppercase * [ci/skip] Add co-authors --------- Co-authored-by: Taiyou06 <[email protected]> Co-authored-by: Altiami <[email protected]>
- Loading branch information
1 parent
aa48b3b
commit b1be529
Showing
7 changed files
with
108 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,10 @@ Original project: https://github.com/KaiijuMC/Kaiiju | |
Original license: GPLv3 | ||
Original project: https://github.com/Bloom-host/Petal | ||
|
||
Co-authored-by: HaHaWTH <[email protected]> | ||
Co-authored-by: Taiyou06 <[email protected]> | ||
Co-authored-by: Altiami <[email protected]> | ||
|
||
This patch was ported downstream from the Petal fork. | ||
|
||
Makes most pathfinding-related work happen asynchronously | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
leaf-server/src/main/java/org/dreeam/leaf/async/path/PathfindTaskRejectPolicy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.dreeam.leaf.async.path; | ||
|
||
import org.dreeam.leaf.config.LeafConfig; | ||
|
||
import java.util.Locale; | ||
|
||
public enum PathfindTaskRejectPolicy { | ||
FLUSH_ALL, | ||
CALLER_RUNS; | ||
|
||
public static PathfindTaskRejectPolicy fromString(String policy) { | ||
try { | ||
return PathfindTaskRejectPolicy.valueOf(policy.toUpperCase(Locale.ROOT)); | ||
} catch (IllegalArgumentException e) { | ||
LeafConfig.LOGGER.warn("Invalid pathfind task reject policy: {}, falling back to {}.", policy, FLUSH_ALL.toString()); | ||
return FLUSH_ALL; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters