Skip to content

[SDK-369] no push reregister on token refresh#1003

Open
franco-zalamena-iterable wants to merge 9 commits intomasterfrom
bugfix/no-push-reregister-on-token-refresh
Open

[SDK-369] no push reregister on token refresh#1003
franco-zalamena-iterable wants to merge 9 commits intomasterfrom
bugfix/no-push-reregister-on-token-refresh

Conversation

@franco-zalamena-iterable
Copy link
Copy Markdown
Contributor

@franco-zalamena-iterable franco-zalamena-iterable commented Mar 13, 2026

🔹 Jira Ticket(s) if any

✏️ Description

Fixed a problem with completeuserlogin retrigger

Decoupling the completeUserLogin from the SetAuthToken flow. Those live independently now.

Summary

setAuthToken replaced with updateAuthToken. This only handles the update of the auth token without the side effects of login. If the user expects a login flow, the setEmail should be called. This prevents unnecessary calls to the backend on token refreshes

@franco-zalamena-iterable franco-zalamena-iterable force-pushed the bugfix/no-push-reregister-on-token-refresh branch from 68f10bc to 6bc8f7b Compare March 13, 2026 14:29
@franco-zalamena-iterable franco-zalamena-iterable force-pushed the bugfix/no-push-reregister-on-token-refresh branch from db3f49f to bc065e5 Compare March 17, 2026 10:40
@franco-zalamena-iterable
Copy link
Copy Markdown
Contributor Author

Wait for bugbash to be completed

Base automatically changed from feature/auto-retry to autoretry-master March 19, 2026 10:43
Base automatically changed from autoretry-master to master March 23, 2026 21:52
@franco-zalamena-iterable franco-zalamena-iterable changed the title Bugfix/no push reregister on token refresh [SDK-406] no push reregister on token refresh Apr 1, 2026
@franco-zalamena-iterable franco-zalamena-iterable force-pushed the bugfix/no-push-reregister-on-token-refresh branch from bc065e5 to 6d3a0b7 Compare April 2, 2026 08:14
@franco-zalamena-iterable franco-zalamena-iterable changed the title [SDK-406] no push reregister on token refresh [SDK-386] no push reregister on token refresh Apr 8, 2026
@franco-zalamena-iterable franco-zalamena-iterable changed the title [SDK-386] no push reregister on token refresh [SDK-369] no push reregister on token refresh Apr 8, 2026
Comment on lines +1079 to +1082
checkAndUpdateAuthToken(authToken);
_setUserSuccessCallbackHandler = successHandler;
_setUserFailureCallbackHandler = failureHandler;
onLogin(authToken, email, true, merge, replay, false, failureHandler);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The checkAndUpdateAuthToken(authToken) call is now redundant on the setEmail and setUserId methods because the onLogin() will always do updateAuthToken(authToken)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, latest commit addresses this

* When the new token arrives, AuthTokenReadyListeners are notified via the
* INVALID → UNKNOWN state transition.
*/
void handleAuthTokenRejection() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This called from IterableTaskRunner.processTask() on a worker thread.
Multiple concurrent 401s could race through the method.
The scheduleAuthTokenRefresh is internally sync'd on timerLock, so it won't double-schedule, but the resetFailedAuth() + getNextRetryInterval() sequence could yield different retry intervals under contention

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i reverted this to what we had on master, will keep this refactor for a different ticket to reduce complexity and possible errors

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.

4 participants