Skip to content

fix: add distributed protection for external auth refresh#27479

Draft
code-asher wants to merge 1 commit into
mainfrom
asher/external-auth-distributed-race
Draft

fix: add distributed protection for external auth refresh#27479
code-asher wants to merge 1 commit into
mainfrom
asher/external-auth-distributed-race

Conversation

@code-asher

@code-asher code-asher commented Jul 23, 2026

Copy link
Copy Markdown
Member

Before refreshing, the caller has to put a lease on the row to prevent any other replicas from trying to refresh using the same token. Callers unable to get a lease enter a holding pattern waiting for the results.

Also use this same lease query to re-read the link. This more or less functions the same as the re-read we used to have after a refresh failure, except it also allows us to avoid making the failed request in the first place. The downside is that we have to refetch the link every time even if the caller just fetched it, but since we have to make a database call anyway...

@code-asher code-asher changed the title fix: Add distributed protection for external auth refresh fix: add distributed protection for external auth refresh Jul 24, 2026
@code-asher
code-asher force-pushed the asher/external-auth-distributed-race branch 5 times, most recently from 4b5e73d to 1192efc Compare July 24, 2026 00:39
Before refreshing, the caller has to put a lease on the row to
prevent any other replicas from trying to refresh using the same token.
Callers unable to get a lease enter a holding pattern waiting for the
results.

Also use this same lease query to re-read the link.  This more or less
functions the same as the re-read we used to have after a refresh
failure, except it also allows us to avoid making the failed request in
the first place.  The downside is that we have to refetch the link every
time even if the caller just fetched it, but since we have to make a
database call anyway...
@code-asher
code-asher force-pushed the asher/external-auth-distributed-race branch from 1192efc to fb50cf0 Compare July 24, 2026 00:47
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