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

Syncer: make sure collections which are deleted are not synced #1065

Conversation

rfc2822
Copy link
Member

@rfc2822 rfc2822 commented Oct 9, 2024

Maybe replaces #1064

@sunkup Does that not work for you?

@rfc2822 rfc2822 added the bug Something isn't working label Oct 9, 2024
@rfc2822 rfc2822 self-assigned this Oct 9, 2024
@rfc2822 rfc2822 linked an issue Oct 9, 2024 that may be closed by this pull request
@rfc2822 rfc2822 requested review from sunkup and removed request for sunkup October 9, 2024 14:38
@rfc2822 rfc2822 marked this pull request as draft October 9, 2024 14:44
@rfc2822 rfc2822 marked this pull request as ready for review October 9, 2024 15:11
@rfc2822 rfc2822 requested a review from sunkup October 9, 2024 15:12
@sunkup
Copy link
Member

sunkup commented Oct 10, 2024

Maybe replaces #1064

@sunkup Does that not work for you?

It works just fine and I thought of doing that too, but I think it's not explicit enough, since createCollections now has that sideeffect. Of course we can document it in the method KDoc, but as a general principle I was taught sideeffects are unclear and therefore dangerous, so I thought we would not want them in the sync code :)

https://en.wikipedia.org/wiki/Side_effect_(computer_science)

* - Deletes local collections if corresponding database collections are missing.
*
* - Deletes local collections if corresponding database collections are missing. If
* a local collection is removed because it's not in [dbCollections], **it becomes also removed from [localCollections]!**
Copy link
Member

@sunkup sunkup Oct 10, 2024

Choose a reason for hiding this comment

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

This is documenting the sideeffect, but it would be better not to have the sideeffect in the first place IMO :)

@rfc2822 rfc2822 merged commit 4a40bb3 into main-ose Oct 10, 2024
8 checks passed
@rfc2822 rfc2822 deleted the 1062-syncer-tries-to-sync-collections-that-it-just-has-deleted-1 branch October 10, 2024 16:08
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 tries to sync collections that it just has deleted
2 participants