( retryCount = 0, force = false, )
| 1536 | } |
| 1537 | |
| 1538 | export function checkAndRefreshOAuthTokenIfNeeded( |
| 1539 | retryCount = 0, |
| 1540 | force = false, |
| 1541 | ): Promise<boolean> { |
| 1542 | // Deduplicate concurrent non-retry, non-force calls |
| 1543 | if (retryCount === 0 && !force) { |
| 1544 | if (pendingRefreshCheck) { |
| 1545 | return pendingRefreshCheck |
| 1546 | } |
| 1547 | |
| 1548 | const promise = checkAndRefreshOAuthTokenIfNeededImpl(retryCount, force) |
| 1549 | pendingRefreshCheck = promise.finally(() => { |
| 1550 | pendingRefreshCheck = null |
| 1551 | }) |
| 1552 | return pendingRefreshCheck |
| 1553 | } |
| 1554 | |
| 1555 | return checkAndRefreshOAuthTokenIfNeededImpl(retryCount, force) |
| 1556 | } |
| 1557 | |
| 1558 | function isTerminalOAuthRefreshFailure(error: unknown): boolean { |
| 1559 | const oauthErrorCode = getOAuthErrorCode(error) |
no test coverage detected