Windows 10 Sync Delayed

One scans the specific file, the other scans the directory the file is in, checking (stat’ing) all files in the directory and children directories.

I suspect it’s due to how change notifications work between different platforms. On Windows it reports the directory where the change happened, on Linux it reports the exact file.

1 Like

This may be the “Aha!” moment. I’ve run tests and their timings are consistent with your explanation – Windows notifies based on directory. However, I question whether the Windows implementation is correct.

Suppose the directory structure is root->sub1->sub2 where sub1 is one level under root and sub2 is one level under sub1.

Here’s how I think syncthing’s implementation works. If a file is created in sub1, the walker searches [sub1] for changes. Based on timings, it appears to also search all subdirectories of sub1 such as sub2. Is that really necessary? If any change happens to a subdirectory, the watcher would have received a notification (e.g. change to [sub1/sub2]). Therefore, only the notified directory has to be searched for changes, not any of the subdirectories. Am I missing something such as an edge case?

Maybe it’s not necessary, maybe it is, we don’t know based on what we’ve been notified, so we do what we think is most likely to find change relates to the notification.

It could be that the implementation of notification library knows the precise file and hides it from us, but I am not going to go on a witch hunt to verify that.

There is watchaggregator that does part of that for us, perhaps that is where it gets “rounded up” but it will definately be because of something the watch library gave us (perhaps it tell us that a directory is modified if a new file os created for example).

You can run the watch library we use yourself and see if you can spot the differences.

Besides, I guess any sync action on our part creates temp files which manifests as a change notification on the parent dir. We know that we did something but we can’t rule out that something else also happened concurrently so I guess we need to scan the dir. And our scans are always recursive. Assuming we don’t get notified about the specific file names that is, then we skip them.

1 Like

I think there is suppression of temp files based on name, and also suppression of files we know we are pulling.

But anyways, yes Windows and Linux is different, what else is new?

Sure, it’s probably some subtlety that could be fixed to make Windows behaviour similar to Linux, but this needs to be addressed by someone who has a need for this.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.