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

SyncAdapterService doesn't cancel on request #975

Closed
rfc2822 opened this issue Aug 13, 2024 · 0 comments · Fixed by #977
Closed

SyncAdapterService doesn't cancel on request #975

rfc2822 opened this issue Aug 13, 2024 · 0 comments · Fixed by #977
Labels
bug Something isn't working

Comments

@rfc2822
Copy link
Member

rfc2822 commented Aug 13, 2024

SyncAdapterService should cancel onPerformSync (but not the actual synchronization) when the sync framework requests cancellation by calling onSyncCanceled.

We have a variable for that:

/**
* Completable [Boolean], which will be set to
*
* - `true` when the related sync worker has finished
* - `false` when the sync framework has requested cancellation.
*
* In any case, the sync framework shouldn't be blocked anymore as soon as a
* value is available.
*/
private val finished = CompletableDeferred<Boolean>()

It's set to true when the sync framework requests cancellation, but it doesn't do anything. It should cause onPerformSync to cancel.

Probably we need to create a CoroutineScope (MainScope?) and cancel this scope instead, like in this example.

Also, this code comment seems wrong:

Instead we check periodically whether the sync has finished, putting the thread to sleep in between checks.

We don't check periodically, but use getWorkInfosForUniqueWorkFlow.

@rfc2822 rfc2822 added the bug Something isn't working label Aug 13, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in DAVx⁵ Releases Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
1 participant