Skip to content

Fix: Syncer synchronizes only once #910

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

Merged
merged 2 commits into from
Jul 15, 2024

Conversation

sunkup
Copy link
Member

@sunkup sunkup commented Jul 14, 2024

Purpose

Fix the Syncer not synchronizing anymore after the first initial sync.

For more see #909

Short description

In #881 we used the same hashmap (remoteCalendars, remoteAddressbooks, ...) for supplying collections to the sync manager and to determine whether a new local resource (calendar, address book, task list, jtx collection) should be created for a new found remote collection. This PR introduces a second hashmap (newCollections), copying from the initial one (remoteCollections) to determine new remote collections by subtraction. The original hashmap (remoteCollections) will then be used to provide the collection to the sync manager when syncing.

This PR will also close the acquired provider in the abstract syncer, which was forgotten in #881.

  • Rename the different remoteCalendars, remoteAddressBooks, etc. collection HashMaps to generic remoteCollections
  • Use a separate HashMap newCollections to determine new remote collections
  • Create new local resources (calendar, address book, task list, jtx collection) from newCollections
  • Use remoteCollections to provide collections when syncing to sync manager.
  • Close content provider after sync in syncer

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.

@sunkup sunkup added the bug Something isn't working label Jul 14, 2024
@sunkup sunkup requested a review from rfc2822 July 14, 2024 11:51
@sunkup sunkup self-assigned this Jul 14, 2024
@sunkup sunkup linked an issue Jul 14, 2024 that may be closed by this pull request
This was referenced Jul 14, 2024
Copy link
Member

@rfc2822 rfc2822 left a comment

Choose a reason for hiding this comment

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

Works!

The provider.close() in the sub-classes is redundant, isn't it? Looks as if we could remove it from the sub-classes. Syncer acquires the client, so it's responsible for closing it.

@sunkup sunkup force-pushed the 909-syncer-synchronizes-only-once branch from f0f6e20 to 9f2fe33 Compare July 15, 2024 08:30
@sunkup sunkup requested a review from rfc2822 July 15, 2024 08:37
@rfc2822 rfc2822 merged commit b3cc24e into main-ose Jul 15, 2024
8 checks passed
@rfc2822 rfc2822 deleted the 909-syncer-synchronizes-only-once branch July 15, 2024 09:00
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
None yet
Development

Successfully merging this pull request may close these issues.

Syncer synchronizes only once
2 participants