Skip to content

Commit c60a39b

Browse files
fix(oauth): let slack refresh followers poll for the lock's full lifetime
1 parent 2c64932 commit c60a39b

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

apps/sim/app/api/auth/oauth/utils.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -680,11 +680,13 @@ interface CoalescedRefreshOutcome {
680680
/**
681681
* Slack lock budgets sized past `TOKEN_REFRESH_TIMEOUT_MS` (15s) in
682682
* lib/oauth/oauth.ts: installation-keyed locks make every sibling row's request
683-
* a follower of one refresh, so followers must keep polling for the leader's
684-
* full provider window and the lock must not expire under a live refresh.
683+
* a follower of one refresh. The lock TTL must not expire under a live refresh
684+
* (15s provider call plus DB reads and the fan-out write), and followers poll
685+
* for the lock's full lifetime so a slow-but-successful refresh is still
686+
* observed rather than reported as a failure.
685687
*/
686-
const SLACK_FOLLOWER_MAX_WAIT_MS = 16_000
687688
const SLACK_LOCK_TTL_SEC = 20
689+
const SLACK_FOLLOWER_MAX_WAIT_MS = SLACK_LOCK_TTL_SEC * 1000
688690

689691
async function performCoalescedRefresh({
690692
accountId,

0 commit comments

Comments
 (0)