Skip to content

fix: rescan a directory only once while its rescan runs - #140

Merged
ilyaZar merged 4 commits into
devfrom
fix-dedupe-subdirectory-rescans
Nov 7, 2026
Merged

ilyaZar merged 4 commits into
devfrom
fix-dedupe-subdirectory-rescans

Conversation

@ilyaZar

@ilyaZar ilyaZar commented Nov 7, 2026

Copy link
Copy Markdown
Member

Follow-up to #138.

#138 moved directory rescans from `localIndex` into goroutines, because `/rest/db/scan` answers only when the scan ends, which waits for any running pull. Nothing limited them: each `LocalIndexUpdated` event could start up to 16, each waiting up to the 8 s response timeout, and repeated events for the same directories during a pull piled them up.

Changes:

  • `rescanSubdirectory` keeps the directories whose rescan is still running and does not ask for them again; once a rescan returns, the directory can be rescanned again
  • bundled binaries and checksums rebuilt

Testing

  • new `TestSubdirectoryRescanIsNotRepeatedWhileInFlight`: a second request for a directory whose scan is blocked in Syncthing is skipped, and a later one goes through; it fails without the guard
  • `go -C core test -race ./...` and `go -C core vet ./...` pass
  • `packaging/bundled/build.sh` with go1.23.12; `packaging/bundled/verify.sh` passes
  • `tests/native-core-architecture.test.sh` passes

@ilyaZar
ilyaZar merged commit 8444b46 into dev Nov 7, 2026
1 check passed
@ilyaZar
ilyaZar deleted the fix-dedupe-subdirectory-rescans branch November 7, 2026 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant