Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore Granular Upload Progress Updates and Database Consolidation #2392

Merged
merged 12 commits into from
Feb 1, 2024

Conversation

MJ1998
Copy link
Collaborator

@MJ1998 MJ1998 commented Dec 26, 2023

IMPORTANT: All PRs must be linked to an issue (except for extremely trivial and straightforward changes).

Fixes #2355 #2408

Description
syncUpload's upload lambda changed from
upload: (suspend (List<LocalChange>) -> UploadSyncResult) TO
upload: (suspend (List<LocalChange>) -> Flow<UploadRequestResult>)

Removed UploadSyncResult as its not needed anymore.
Uploader.upload returns a Flow
Modified UploadRequestResult.Failure to have information about localChanges.
Added bundleSize as a config parameter to UploadRequestGeneratorMode.BundleRequest to test with bundleSize = 1
Added test case to check flow of multiple results being returned.

Alternative(s) considered
Alternative was to solve for #2408 only by returning partial successes also in the consolidated UploadSyncResult in case there is a failure. This is developer-convenient as it does not require much change but does not solve both the issues. Also, we anticipate changing this API (in fact potentially moving this API completely) and minimal change could be preferred. However, with a little developer pain we can solve both the issues. Discussed with @aditya-07.

Type
Choose one: (Bug fix | Feature | Documentation | Testing | Code health | Builds | Releases | Other)

Screenshots (if applicable)

Checklist

  • I have read and acknowledged the Code of conduct.
  • I have read the Contributing page.
  • I have signed the Google Individual CLA, or I am covered by my company's Corporate CLA.
  • I have discussed my proposed solution with code owners in the linked issue(s) and we have agreed upon the general approach.
  • I have run ./gradlew spotlessApply and ./gradlew spotlessCheck to check my code follows the style guide of this project.
  • I have run ./gradlew check and ./gradlew connectedCheck to test my changes locally.
  • I have built and run the demo app(s) to verify my change fixes the issue and/or does not break the demo app(s).

@MJ1998 MJ1998 changed the title Upload giving intermediate progresses Restore Granular Upload Progress Updates and Database Consolitdation Jan 8, 2024
@MJ1998 MJ1998 changed the title Restore Granular Upload Progress Updates and Database Consolitdation Restore Granular Upload Progress Updates and Database Consolidation Jan 9, 2024
@MJ1998 MJ1998 marked this pull request as ready for review January 29, 2024 10:48
@MJ1998 MJ1998 requested review from santosh-pingle and a team as code owners January 29, 2024 10:48
Copy link
Collaborator

@aditya-07 aditya-07 left a comment

Choose a reason for hiding this comment

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

Excellent work @MJ1998 !! Have a few suggestions and added some comment related to the existing issues that I found in the code. The existing code issues are mostly harmless and can be fixed in later PR's by the team.

Copy link
Collaborator

@aditya-07 aditya-07 left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@MJ1998 MJ1998 merged commit 616983e into google:master Feb 1, 2024
3 checks passed
sharon2719 pushed a commit to opensrp/android-fhir that referenced this pull request Feb 6, 2024
…oogle#2392)

* Upload giving intermediate progresses

* emit uploadresults until its a Failure

* tests

* add test to verify multiple results emit

* extra code

* fix test issue

* update merge

* resolve comments
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Complete
Development

Successfully merging this pull request may close these issues.

SyncUploadProgress Only Emits on Batch Success, Delaying Database Consolidation
4 participants