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

Task result is based on sync status #323

Merged
merged 6 commits into from May 13, 2024

Conversation

ArnyminerZ
Copy link
Member

@ArnyminerZ ArnyminerZ commented May 8, 2024

Purpose

Right now, we are always returning Result.success() in BaseSyncWorker, even if ProcessEventsTask fails. There should be proper error results.

Short description

Added a return type to ProcessEventsTask.sync, if the synchronization is successful (exception is null) returns true, otherwise returns false.

Then, the result is received by BaseSyncWorker, which then if any of the subscriptions returns false while synchronizing, outputs Result.failure, otherwise Result.success.

Tests added:

  • One simple synchronization test, which takes an ICS file from resources and runs the worker with it. The result is expected to be successful.
  • Another test which adds two subscriptions: the same local one as before, and a remote one which doesn't exist.
    The result is expected to be a failure because even though the first subscription is synchronized correctly, the second one fails.

Checklist

  • The PR has a proper title, description and label.
  • I have self-reviewed the PR.
  • I have added documentation to complex functions and functions that can be used by other modules.
  • I have added reasonable tests or consciously decided to not add tests.

Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
@ArnyminerZ ArnyminerZ linked an issue May 8, 2024 that may be closed by this pull request
@ArnyminerZ ArnyminerZ self-assigned this May 8, 2024
@ArnyminerZ ArnyminerZ added the enhancement New feature or request label May 8, 2024
Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
@ArnyminerZ ArnyminerZ requested a review from sunkup May 9, 2024 08:03
@ArnyminerZ ArnyminerZ marked this pull request as ready for review May 9, 2024 08:05
Copy link
Member

@sunkup sunkup left a comment

Choose a reason for hiding this comment

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

👍

@sunkup sunkup merged commit d56eab3 into dev May 13, 2024
7 checks passed
@sunkup sunkup deleted the 305-worker-result-does-not-match-sync-result branch May 13, 2024 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Worker result does not match sync result
2 participants