feat(core): a client can work jobs without standing for leader - #46
Merged
Merged
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Config.NeverLeadkeeps a client out of leader elections. It still claims and works jobs from its queues like any other client, but never runs the leader's duties: rescue, retention and history maintenance, periodic jobs, and stream delivery.The use case is a process that shares an install it should not run, for example a developer's local worker pointed at a shared development environment on a queue of its own. Without this option such a process can be elected leader and run rescue and retention for the whole install.
An install whose clients all set it has no leader, so nothing is rescued or pruned; the operations guide says so.
Testing
TestNeverLeadClientWorksJobsWithoutLeading: aNeverLeadclient works a job, and no leader row appears over several leader intervals. A second, normal client becomes leader while the first stays a follower. With the change reverted the test fails (a NeverLead client became leader).-raceagainst Postgres 18, andgolangci-lint, pass.No SQL changed, and nothing on the insert, claim or finalize paths.
Checklist
make checkpasses (core module lint and all tests run locally)GODEBUG=fips140=only)docs/PLAN.md