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

api support for sync job cancellation. #2717

Merged
merged 14 commits into from
Jan 29, 2025

Conversation

santosh-pingle
Copy link
Collaborator

@santosh-pingle santosh-pingle commented Nov 11, 2024

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

Fixes #2695

Description
Once a one-time or periodic sync job is canceled, it should emit the current sync job status. The cancel state, represented by the WorkInfo state, needs to be transformed into the current sync job status. This is done by listening to the WorkInfo state and mapping it to the current sync job status, using the WorkManager state for intermediate states and the FhirDataStore state for terminal states.

Alternative(s) considered
Have you considered any alternatives? And if so, why have you chosen the approach in this PR?

Type
Choose one: Feature

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).

@santosh-pingle
Copy link
Collaborator Author

Screen.Recording.2024-11-11.at.12.24.05.PM.mov
Screen.Recording.2024-11-11.at.2.23.30.PM.mov

@santosh-pingle santosh-pingle marked this pull request as ready for review November 26, 2024 05:31
@santosh-pingle santosh-pingle requested a review from a team as a code owner November 26, 2024 05:31
Copy link
Collaborator

@MJ1998 MJ1998 left a comment

Choose a reason for hiding this comment

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

One way to do this is to accept ExistingWorkPolicy in sync apis. Instead of ExistingWorkPolicy.KEEP if application provides ExistingWorkPolicy.REPLACE, workmanager library will cancel the current one and add new one with the same name.

Why not the above approach ?

@jingtang10 jingtang10 enabled auto-merge (squash) January 27, 2025 05:48
@santosh-pingle santosh-pingle requested a review from MJ1998 January 28, 2025 09:23
@santosh-pingle santosh-pingle requested a review from MJ1998 January 28, 2025 10:35
@santosh-pingle santosh-pingle requested a review from MJ1998 January 29, 2025 06:33
Copy link
Collaborator

@MJ1998 MJ1998 left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks Santosh.

@jingtang10 jingtang10 merged commit be94dd5 into google:master Jan 29, 2025
6 checks passed
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.

Add API to cancel sync jobs
3 participants