-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Update local metadata when merging trashing
By keeping track of the remote metadata `trashed` attribute in PouchDB we're able to detect the restoration of the remote file from the Cozy trash before we had a chance to trash the local file and thus avoid it. However, we don't have any metadata in local trashing events (the file does not exist anymore so we can't get any from the local filesystem) so we were simply looking for the matching document in PouchDB and marking it with a `trashed` attribute, not making any change to the local metadata. This means that if we would receive a subsequent event with the exact same metadata as the "old" local one, we would find it perfectly equal to the local metadata in PouchDB thus not save it and thus not cancel the trashing. It's unclear to this point how this situation can happen but we've seen production logs with the trashing of the file during the local initial scan because the `scan` event would be handled after we generated the `deleted` event. Adding the `trashed` attribute in the local metadata would at least avoid the consequences.
- Loading branch information
1 parent
f56d88e
commit ce30469
Showing
6 changed files
with
821 additions
and
514 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.