[Feat] Add backoff to OperationRepo when retrying network calls #2017
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_id
but differentonesignal_id
values due to this fast retrying.OperationRepo.force
is true, which causes the 5 second batching to delay to be skipped, which normally get set when callingOneSignal.login
Scope
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
500
response. Also after we stop getting a500
error 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