Skip to content

feat(auth): queue due refreshes when the store has a refresh queue - #25

Open
yordis wants to merge 1 commit into
yordis/feat-natsstore-refreshstreamfrom
yordis/feat-natsstore-refreshdispatch
Open

yordis wants to merge 1 commit into
yordis/feat-natsstore-refreshstreamfrom
yordis/feat-natsstore-refreshdispatch

Conversation

@yordis

@yordis yordis commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

When the store has a refresh queue, a replica that finds a credential due should publish a request, not refresh inline. Otherwise every replica refreshes the same credential and a single-use grant is burned by whichever loses.

Every replica's scheduler finds the same expiring credential due and each
sends its own refresh, which wastes provider calls and, for a grant that
rotates, risks losing the credential. When the store shares a refresh
queue the scheduler now asks it instead, and the replica that wins the
request refreshes through the same journal-guarded path as before. A
grant that rotates waits when the queue is unreachable, since the queue is
what keeps two replicas from spending it together; a reusable grant
refreshes inline. Stores without a queue behave as before.

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
@coderabbitai

coderabbitai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3ac8cc52-7f88-4cd9-9cf7-39fccab5abdc
Commits

Reviewing files that changed from the base of the PR and between d9504d0 and 87e28d1.

Files selected for processing: 5

  • sdk/cliproxy/auth/auto_refresh_loop.go
  • sdk/cliproxy/auth/conductor.go
  • sdk/cliproxy/auth/conductor_refresh.go
  • sdk/cliproxy/auth/refresh_queue.go
  • sdk/cliproxy/auth/refresh_queue_test.go
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@yordis
yordis added this pull request to stack #9 November 8, 2026 03:32

This branch has not been deployed

No deployments
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