[v5] Pause operation repo and retry failed user create#1900
Merged
nan-li merged 1 commit intouser-model/mainfrom Dec 1, 2023
Merged
[v5] Pause operation repo and retry failed user create#1900nan-li merged 1 commit intouser-model/mainfrom
nan-li merged 1 commit intouser-model/mainfrom
Conversation
Successful user creation is vital to the functioning of the SDK. Problem: If the create user request fails with an un-retryable error such as a 400 response, the SDK would not retry and stay in an unrecoverable error state with no onesignal_id, and no subscription_id (potentially). Therefore, it would never register, send data, or receive notifications. The only way out was to uninstall the app. Solution: Let's give the SDK a chance to recover from failed user creation, similar to the behavior of the iOS SDK. When met with this error, we will pause the operation repo from executing any more operations as it is impossible to do anything without a onesignal_id. Then, on new sessions or new cold starts, we will retry the still-cached operation, in the hopes that perhaps it can succeed at this later date.
jkasten2
approved these changes
Dec 1, 2023
Member
jkasten2
left a comment
There was a problem hiding this comment.
Would be nice to retry when there is change, instead of pausing and needing to restart the app. However that would be a pretty large refractor, so I think this is a good fix for now.
Merged
jinliu9508
pushed a commit
that referenced
this pull request
Jan 31, 2024
[v5] Pause operation repo and retry failed user create
jinliu9508
pushed a commit
that referenced
this pull request
Jan 31, 2024
[v5] Pause operation repo and retry failed user create
jinliu9508
pushed a commit
that referenced
this pull request
Feb 6, 2024
[v5] Pause operation repo and retry failed user create
jkasten2
added a commit
that referenced
this pull request
Feb 15, 2024
PR #1900 intorduced FAIL_PAUSE_OPREPO but never updated the test
jkasten2
added a commit
that referenced
this pull request
Feb 21, 2024
PR #1900 intorduced FAIL_PAUSE_OPREPO but never updated the test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
One Line Summary
Give the SDK a future chance to recover from failed user creation, similar to the behavior of the iOS SDK.
Details
Successful user creation is vital to the functioning of the SDK.
Problem:
If the create user request fails with an un-retryable error such as a 400 response, the SDK would not retry and stay in an unrecoverable error state with no onesignal_id, and no subscription_id (potentially). Therefore, it would never register, send data, or receive notifications. The only way out was to uninstall the app.
Solution:
Let's give the SDK a chance to recover from failed user creation, similar to the behavior of the iOS SDK. When met with this error, we will pause the operation repo from executing any more operations as it is impossible to do anything without a onesignal_id.
Then, on new sessions or new cold starts, we will retry the still-cached operation, in the hopes that perhaps it can succeed at this later date.
Motivation
If the create user request fails with an un-retryable error such as a 400 response, the SDK would not retry and stay in an unrecoverable error state with no onesignal_id, and no subscription_id (potentially).
Scope
Only affects user create requests that receive a 400-range error.
Testing
Unit testing
None, but can consider adding in the future to mimic the behavior
Manual testing
Android emulator API 33
slat time of testing)enAffected code checklist
Checklist
Overview
Testing
Final pass
This change is