Bugfix: Limit the background activity of the FileProviderExtension #212
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Limits the background activity of the FileProviderExtension and thus fixes #206.
Due to the invalidation of the working set introduced in #156 a new enumeration of the working set was periodically triggered by the Files app in the case of a locked vault. This led to increased and unnecessary background activity of the FileProviderExtension.
This has now been fixed as follows:
When a vault is locked, the working set is invalidated once - this updates the sync anchor, which now has the invalidated flag set. If a subsequent
enumerateChanges(for:from:)
for the sync anchor fails with the invalidated flag set, the working set is not invalidated again, but the Files app is simply informed that there were no changes to the working set. This breaks the loop and the next time the vault is successfully unlocked, the working set will be enumerated from scratch again and the sync anchor will be updated, i.e. the updated date will be renewed and the invalidated flag will be removed.Furthermore, XPC connections were not invalidated which caused the reference count for the
FileProviderExtension
to remain incremented after using an XPC connection. This has now also been fixed so that theFileProviderExtension
object does not have to be held in memory longer than necessary.