Skip to content

Fix leaderboard/tournament hooks sometimes not firing.#2476

Open
sesposito wants to merge 4 commits intomasterfrom
spe/tournament-end-fix
Open

Fix leaderboard/tournament hooks sometimes not firing.#2476
sesposito wants to merge 4 commits intomasterfrom
spe/tournament-end-fix

Conversation

@sesposito
Copy link
Member

Remove some potential race conditions that could cause reset/end hooks not to fire.

Resolves #2429

Remove some potential race conditions that could cause reset/end
hooks not to fire.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes an intermittent race in LocalLeaderboardScheduler where tournament end/reset hooks can be skipped when end-active and expiry land on the same Unix second.

Changes:

  • Add scheduledEndActive / scheduledExpiry tracking to avoid cancelling the “other” timer when both target the same second.
  • Simplify timer stopping behavior in Pause()/Stop().
  • Add an (currently skipped) auxiliary test and update the changelog entry.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.

File Description
server/leaderboard_scheduler.go Avoids stopping/replacing timers when rescheduling to the same Unix second.
server/leaderboard_scheduler_test.go Adds an auxiliary (skipped) test intended to reproduce the race condition.
CHANGELOG.md Adds a release note about the fix.
data/modules/tournament.lua Adds a trailing newline.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

sesposito and others added 2 commits March 16, 2026 16:49
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.

[Bug Report] Tournament scheduler may skip end/reset when they share the same second

2 participants