REST API /rest/db/scan does not complete when files syncing

When files are being synced to the local computer, the /rest/db/scan API call does not return, although other calls seem to work. Is this a feature to prevent simultaneous updates of the same file? It seems to occur regardless of whether the file being scanned is being synced. I would like to be able to continue scanning the parts of the folder that aren’t currently being synced so that syncing doesn’t tie up the whole system. Would that be a bad idea or require significant changes to the codebase?

Please let me know if I am misunderstanding something about how this works! I have taken a cursory look through the codebase, but haven’t spent enough time to really understand it. I would be happy to help make some changes if there aren’t any consequences that I haven’t thought of, and it wouldn’t destabilize the system.

Thanks, Jeff

Syncthing states are exclusive and for the whole folder, so it either syncs or scans.

I don’t see a good reason why in needs to be this way, as we could “lock” around individual items (or trees of items) oppose to the whole folder, but it would be a lot of effort to make it work this way.