Improvement #31467
open
Added by Sachin Suresh 4 months ago.
Updated 4 months ago.
Due date:
12/19/2025 (about 4 months late)
Description
Implement a mechanism to notify other browser tabs when the currency is changed in one tab. The other tabs should display an alert asking the user if they want to update their view to the new currency.
- Subject changed from 2Currency Synchronization Implementation Plan to Currency Synchronization Implementation Plan
- Status changed from Assigned to In Progress
- Status changed from In Progress to Fixed not Tested
- % Done changed from 0 to 100
- Improvement #31319: Concurrent Token Refresh Fix
- Issue
Previous implementation of `getSession` in `auth-actions.ts` had a race condition. When multiple tabs or concurrent requests (e.g., flight search + user profile fetch) attempted to refresh an expired token simultaneously:
1. Both requests would initiate a refresh call to the Identity Provider.
2. The first one would succeed and rotate the refresh token.
3. The second one would fail (because the refresh token was invalidated by the first call).
4. This would trigger "Guest Recovery" or logout, breaking the session for the second tab/request.
- Fix Implementation
Implemented a Promise Deduplication pattern (Mutex) in `src/actions/auth-actions.ts`.
- Introduced a module-level `refreshPromises` map.
- Before refreshing, the system checks if a refresh promise is already pending for the `sessionId`.
- If a promise exists, the new request simply waits for that existing promise to resolve and reuses the result.
- If no promise exists, a new one is created, stored, and executed.
This ensures that only *one network call is made to the Identity Provider per session, regardless of how many concurrent requests are triggered.
Also available in: Atom
PDF