Skip to content

fix(scheduler): add advisory-lock leader election - #675

Open
woahwhattheheck wants to merge 15 commits into
Protocol-Guild:mainfrom
woahwhattheheck:sol56/payd501-advisory-leader-20261004
Open

woahwhattheheck wants to merge 15 commits into
Protocol-Guild:mainfrom
woahwhattheheck:sol56/payd501-advisory-leader-20261004

Conversation

@woahwhattheheck

@woahwhattheheck woahwhattheheck commented Oct 5, 2026 •

Copy link
Copy Markdown

Fixes #501

Summary

  • add single-owner scheduler leadership using a dedicated database PoolClient, keeping the advisory lock bound to one session for each scheduler pass
  • retain the existing row-level work claims and scheduled-job path
  • keep the local runInProgress fence so one replica cannot overlap its own scheduled cycles
  • probe leadership every 15 seconds
  • keep the change bounded to the scheduler and its focused regression coverage
  • assign a fresh UUID owner token to each scheduler pass and require that owner for row release and finalization;
  • renew all active/queued claimed rows every 60 seconds while the pass runs;
  • fence schedule status/next-run updates by row owner and reject finalization after ownership loss.

Validation

Current carrier head: 51b502bdd3db1ca8b5b17552cc648885c5fe115a — 15 commits, 4 issue-scoped files (two services and their focused regression files).

The UUID ownership, renewal, and status-fencing regressions were authored but not run. Historical build/test and E2E results predate these source changes and are not evidence for current scheduler/failover behavior.

Exact-head build run 37742203154 and secrets run 37742202194 completed as failure with 0 jobs created. No current-head scheduler execution, production multi-replica soak, or failover benchmark is established.

Contribution and payment

The existing /claim #501 and original contributor/payee @woahwhattheheck remain in place. I am claiming this delivered contribution and requesting the applicable GrantFox Third Campaign payment. Please confirm eligibility, assignment, the reward amount, and the payout method and timing. Application, acceptance, award, and settlement are separate decisions.

@woahwhattheheck

Copy link
Copy Markdown
Author

/claim #501

Original-author GrantFox OSS/FWC26 contribution and conditional compensation claim: I, @woahwhattheheck (GitHub account ID 293286387), submit this original contribution for issue #501 and affirmatively claim contributor credit and consideration for any eligible bounty compensation under the campaign terms. Please confirm eligibility, acceptance criteria, award amount (if applicable), and payment instructions. No award or payment is presumed.

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.

Add leader election for scheduled background jobs

1 participant