Skip to content

Conversation

@joaodordio
Copy link
Member

@joaodordio joaodordio commented Dec 11, 2025

🔹 Jira Ticket(s)

✏️ Description

When multiple network requests fail simultaneously with 401 JWT errors, only the first request gets retried after token refresh. Subsequent requests are silently dropped because their retry callbacks are not queued when a token refresh timer is already active.

Root Cause

In AuthManager.scheduleAuthTokenRefreshTimer(), when isTimerScheduled is true, the method returns early without storing the callback, causing it to be lost.

Solution

  • Added thread-safe callback queue (pendingSuccessCallbacks) to store retry callbacks when timer is active
  • Modified scheduleAuthTokenRefreshTimer to queue callbacks instead of dropping them
  • All queued callbacks are invoked when token refresh completes
  • Callbacks are properly cleared on logout and when no user is available

@joaodordio joaodordio self-assigned this Dec 11, 2025
@codecov
Copy link

codecov bot commented Dec 11, 2025

Codecov Report

❌ Patch coverage is 95.74468% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.44%. Comparing base (abbab6a) to head (6bf6e49).

Files with missing lines Patch % Lines
swift-sdk/Internal/RequestProcessorUtil.swift 90.47% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #984      +/-   ##
==========================================
+ Coverage   69.26%   69.44%   +0.18%     
==========================================
  Files         109      109              
  Lines        8917     8944      +27     
==========================================
+ Hits         6176     6211      +35     
+ Misses       2741     2733       -8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@joaodordio joaodordio marked this pull request as ready for review December 12, 2025 16:46
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.

2 participants