Skip to content

Make leaderResignedChan buffered to protect against hang#1205

Open
brandur wants to merge 1 commit intomasterfrom
brandur-resigned-buffered
Open

Make leaderResignedChan buffered to protect against hang#1205
brandur wants to merge 1 commit intomasterfrom
brandur-resigned-buffered

Conversation

@brandur
Copy link
Copy Markdown
Contributor

@brandur brandur commented Apr 12, 2026

This one's aimed at fixing an intermittently failing tests that we're
occasionally seeing in CI:

https://github.com/riverqueue/river/actions/runs/24312334093/job/70984031771?pr=1203

It was possible for the test case to end to leaderResignedChan before
keepLeadershipLoop entered its select, which with an unbuffered
channel, could block forever. Changing this to a buffered channel lets
keepLeadershipLoop consume the value as its leisure while making sure
the send never blocks.

This one's aimed at fixing an intermittently failing tests that we're
occasionally seeing in CI:

https://github.com/riverqueue/river/actions/runs/24312334093/job/70984031771?pr=1203

It was possible for the test case to end to `leaderResignedChan` before
`keepLeadershipLoop` entered its select, which with an unbuffered
channel, could block forever. Changing this to a buffered channel lets
`keepLeadershipLoop` consume the value as its leisure while making sure
the send never blocks.
@brandur
Copy link
Copy Markdown
Contributor Author

brandur commented Apr 12, 2026

@codex review

Admittedly, Claude did all the debugging work on this one. I figure we can cross-reference the proposed solution with Codex and make sure it's all above bar.

@brandur
Copy link
Copy Markdown
Contributor Author

brandur commented Apr 12, 2026

Man, have hit three intermittently failing tests in a row now ... and they're all different lol. I'm not sure if we regressed recently on this front or what.

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@brandur brandur requested a review from bgentry April 12, 2026 17:58
@brandur
Copy link
Copy Markdown
Contributor Author

brandur commented Apr 12, 2026

Actually, two of these are related to the leadership changes I made recently, so they are pretty new.

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