-
Notifications
You must be signed in to change notification settings - Fork 145
Type, document, and refactor Sync, port tests to Mocha #1331
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
base: master
Are you sure you want to change the base?
Conversation
Accidentally left a `.only` in the last commit
Added a rather useful change for conflict events: handling them in apps doesn't require manually using Also, My Favorite Drinks now has support for updating drinks and it will automatically handle conflicts: https://github.com/remotestorage/myfavoritedrinks/blob/master/app.js#L50-L59 |
012e75d
to
91bf93d
Compare
This way, apps can use these the same way as they can use other change events.
91bf93d
to
16fbeb4
Compare
This can cause documents to either not be deleted at all when they should be, but at the least for the parent folder's `local` itemsMap to become inconsistent and potentially persist forever, because it can never be the same as the remote itemsMap again (which is the criterium for removing it).
No changes can be lost when documents are deleted on both ends
11ad749
to
d04f334
Compare
I was able to address almost all of the sub-issues of #1251 in this PR now. The couple of issues that are left open should be addressed in separate PRs after this one is merged. |
It doesn't matter if a client received `sync-started` or not. When there are no more tasks to run after any task has finished successfully, the sync is done. Also removes a superfluous second log statement for when sync is done.
The tests pass on my dev machine, the tests appear to cover new/changed functionality, and there's no code smell. But I'm not familiar enough with the syncing code sign off on this. |
@galfert Any chance you could have a look at this soon? |
We'll have to merge this soon, because I cannot add any more PRs against this one. It's already too large. |
Since it's been about two months, I would ask or tag other core people individually and wait a day or two for any commitment to review, else merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM, tests are all passing 👍
I tried CRUD on this rough build of hyperdraft and it seemed to sync fine between 2 private windows https://test-hyperdraft.remit.rosano.ca/en/write |
Bonus: if your app uses change events with origin |
Looking forward to implementing that in future apps, and maybe documenting. |
Includes some small other improvements. However, this PR is mostly about properly typing and documenting sync, as well as making the functions more readable by using async/await in many places.
Noteworthy additional changes:
refs #1251 (where I added sub-issues that are all easier to tackle with these changes)
refs #1270
closes #1173
closes #839
fixes #1335
fixes #1204
P.S.: I rebased the branch as much as possible before opening the PR. But there are too many conflicts when trying to consolidate the rest even more.