[Feat] Add backoff to OperationRepo when retrying network calls#2017
Merged
[Feat] Add backoff to OperationRepo when retrying network calls#2017
Conversation
If we got a 5xx response from the OneSignal backend we were retrying immediately. This result wasn't positive for the end-user, device, or OneSignal's backend. To ensure this works as expected we updated the retrying test to confirm the delay is called. Also to ensure this commit works as intended I ran this on an Android 14 emu and ensured it waits the right amount of time when there is 500 response. Also after we stop getting a 500 error the queue successfully resumes and all pending tags are even added too.
nan-li
approved these changes
Mar 7, 2024
Contributor
nan-li
left a comment
There was a problem hiding this comment.
LGTM
- In my testing, without this PR, retries happen every 5 seconds, so they weren't so immediate as is.
- I do think there are some code paths that do because I have seen my logcat spamming retries in the past.
Member
Author
|
@nan-li Thanks for the review!
In my testing there are cases where
|
This was referenced Mar 28, 2024
Merged
This was referenced Apr 10, 2024
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
Add a delay to retries with a backoff to slow down network calls from
OperationRepo.Details
Motivation
Retrying too quickly:
external_idbut differentonesignal_idvalues due to this fast retrying.OperationRepo.forceis true, which causes the 5 second batching to delay to be skipped, which normally get set when callingOneSignal.loginScope
Only affects adding a delay to retries on
OperationRepo.Testing
Unit testing
To ensure this works as expected we updated the retrying test to confirm the delay is called.
Manual testing
Also to ensure this commit works as intended I ran this on an Android 14 emu and ensured it waits the right amount of time when there is
500response. Also after we stop getting a500error the queue successfully resumes and all pending tags are even added too. While it's waiting for the next retry I ensured it didn't lock main thread as well.Affected code checklist
Checklist
Overview
Testing
Final pass
This change is