[Improvement] Never set OperationRepo.enqueue's flush to true#2055
Merged
[Improvement] Never set OperationRepo.enqueue's flush to true#2055
Conversation
OneSignal.login() was setting OperationRepo.enqueue to true, while this means the OneSignal backend is updated up to 5 seconds faster it means a possible increase in load, as not having a delay means we may not have batched as many network requests. There is a high chance we will re-introduce the flush via a new public commit() method, so it wasn't remove in this commit. But before doing so we need budget rules so it can't be abused. One oddly I notice here is the login had a flush, but the logout did not. This seems like a bug, but either way we don't want to flush anywhere now.
Contributor
Member
Author
Yes, these operations are stored locally when enqueued, that way if the app is killed they are not lost and the queue can be resumed when the app started again.
Removing the use of this flush flag means that the starting delay won't be skipped, so more operations could be grouped together after this PR. On the 404 issue, I believe this should help slow down (by 5 seconds) the tight loop (with the introduction of the bucket concept) but not fix the looping of create User itself. |
jinliu9508
approved these changes
Apr 15, 2024
Base automatically changed from
fix/op-repo-add-bucketing-to-limit-network-calls-further
to
main
April 15, 2024 20:31
Merged
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
Never set
OperationRepo.enqueue'sflushtotrueto improve network batching.Details
Motivation
The 5.x.x branch of the OneSignal SDK is not as efficient on it's network calls as 4.x.x was. This is one small change to help improve some of this.
Scope
Only effects delaying networks calls generated when calling
OneSignal.loginby up to seconds 5.Testing
Manual testing
Tested calling
OneSignal.loginand ensured it was delayed by 5 seconds as expected.Affected code checklist
Checklist
Overview
Testing
Final pass
This change is