Skip to content

Run offline placeholder lookups off the Minecraft main thread - #4

Merged
SrBedrock merged 5 commits into
masterfrom
fix/off-thread-placeholder-lookups
Oct 5, 2026
Merged

SrBedrock merged 5 commits into
masterfrom
fix/off-thread-placeholder-lookups

Conversation

@SrBedrock

Copy link
Copy Markdown
Member

Summary

  • resolve Bukkit.getOfflinePlayer(UUID) directly on the Spark/Jetty request worker
  • evaluate PlaceholderAPI.setPlaceholders(...) on the same worker instead of scheduling onto the Bukkit main thread
  • keep the existing max-concurrent semaphore as the concurrency bound
  • remove the old lookup timeout configuration because synchronous evaluation on the current Spark worker cannot be safely preempted
  • update shutdown regression coverage and document the off-thread expansion requirement

Rationale

Spark already dispatches HTTP routes on its Jetty worker pool. Scheduling every REST lookup back onto the Bukkit scheduler serialized placeholder evaluation onto the server tick thread and made offline lookups contribute directly to tick latency.

This change reuses the existing Spark worker pool rather than introducing an additional executor or virtual-thread layer.

Compatibility

PlaceholderAPI expansions queried through this endpoint must support off-thread execution. PlaceholderAPI invokes expansion code synchronously and does not make third-party expansions thread-safe automatically.

Existing configurations containing timeout-ms remain loadable; the key is simply no longer used.

Validation

GitHub Actions runs bash gradlew test shadowJar --no-daemon on JDK 25.

@SrBedrock
SrBedrock merged commit b9f5ece into master Oct 5, 2026
1 check passed
@SrBedrock
SrBedrock deleted the fix/off-thread-placeholder-lookups branch October 5, 2026 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant