Skip to content

Fix Folia task lifecycle during reload - #4

Open
Minecraft0122 wants to merge 1 commit into
plan-player-analytics:masterfrom
Minecraft0122:codex/folia-reload-task-lifecycle
Open

Fix Folia task lifecycle during reload#4
Minecraft0122 wants to merge 1 commit into
plan-player-analytics:masterfrom
Minecraft0122:codex/folia-reload-task-lifecycle

Conversation

@Minecraft0122

Copy link
Copy Markdown

Summary

  • invalidate callbacks created by an earlier Folia plugin lifecycle so they cannot execute after cancelAllKnownTasks() during reload
  • wait for already-running Folia tasks before cancellation returns, while allowing cancellation from inside the current task without deadlocking
  • convert async scheduler delays from ticks to milliseconds with TimeAmount.ticksToMillis instead of dividing ticks by 20
  • keep the behavior in the shared Folia platform layer, so Plan and other PAL consumers do not need plugin-specific scheduler implementations

Tests

  • old-lifecycle callbacks are ignored and new-lifecycle callbacks still execute
  • cancellation waits for a running task to finish
  • cancellation initiated by the running task does not deadlock
  • 20/40/60 ticks map to 1000/2000/3000 milliseconds for asynchronous scheduling
  • JAVA_HOME=C:\Program Files\Java\jdk-21 ./gradlew :api:check :folia:check --rerun-tasks passes locally

Context

This moves the Folia scheduling portion of plan-player-analytics/Plan#4772 into PAL as requested by review. It addresses plan-player-analytics/Plan#4599 without adding a Plan-specific platform layer.

The repository-wide check currently stops in the untouched BungeeCord module because net.md-5:brigadier:1.0.16-SNAPSHOT is no longer resolvable; the affected api and folia checks pass.

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