Skip to content

Commit 34f302b

Browse files
fix(oauth): let slack refresh followers poll for the lock's full lifetime
1 parent aa7af2f commit 34f302b

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
@@ -506,11 +506,13 @@ interface CoalescedRefreshOutcome {
506506
/**
507507
* Slack lock budgets sized past `TOKEN_REFRESH_TIMEOUT_MS` (15s) in
508508
* lib/oauth/oauth.ts: installation-keyed locks make every sibling row's request
509-
* a follower of one refresh, so followers must keep polling for the leader's
510-
* full provider window and the lock must not expire under a live refresh.
509+
* a follower of one refresh. The lock TTL must not expire under a live refresh
510+
* (15s provider call plus DB reads and the fan-out write), and followers poll
511+
* for the lock's full lifetime so a slow-but-successful refresh is still
512+
* observed rather than reported as a failure.
511513
*/
512-
const SLACK_FOLLOWER_MAX_WAIT_MS = 16_000
513514
const SLACK_LOCK_TTL_SEC = 20
515+
const SLACK_FOLLOWER_MAX_WAIT_MS = SLACK_LOCK_TTL_SEC * 1000
514516

515517
async function performCoalescedRefresh({
516518
accountId,

0 commit comments

Comments
 (0)