Scan the libraries by themselves when their music changed #36

Merged
squid merged 1 commit from feat/auto-scan into main 2026-11-16 12:05:33 +00:00
Owner

Closes #35

Sonda looks at the folders of each library by itself and scans the ones whose music changed.

  • Every 15 minutes (library.auto_scan_minutes, SONDA_AUTO_SCAN_MINUTES; 0 turns it off) it takes the signature of each library: a hash of the names of everything in it, folder by folder. Looking costs only the names of the files, so it is cheap for a NAS that sleeps.
  • A library whose signature changed (a song or a folder came, went or was renamed) is scanned the usual way. Every library is also scanned at least once a day, to find a song that was tagged again where it stands.
  • It never scans while another scan runs, tries again at the next look when a scan failed, leaves alone a folder it cannot read (a NAS that is not mounted) and ignores the housekeeping folders of a NAS (@eaDir...).
  • Checked: Go tests with -race on SQLite, storage/library/config on PostgreSQL, and a running server: a song copied into a library was found by itself after 20 seconds.
Closes #35 Sonda looks at the folders of each library by itself and scans the ones whose music changed. - Every 15 minutes (`library.auto_scan_minutes`, `SONDA_AUTO_SCAN_MINUTES`; `0` turns it off) it takes the signature of each library: a hash of the names of everything in it, folder by folder. Looking costs only the names of the files, so it is cheap for a NAS that sleeps. - A library whose signature changed (a song or a folder came, went or was renamed) is scanned the usual way. Every library is also scanned at least once a day, to find a song that was tagged again where it stands. - It never scans while another scan runs, tries again at the next look when a scan failed, leaves alone a folder it cannot read (a NAS that is not mounted) and ignores the housekeeping folders of a NAS (`@eaDir`...). - Checked: Go tests with -race on SQLite, storage/library/config on PostgreSQL, and a running server: a song copied into a library was found by itself after 20 seconds.
Every 15 minutes (library.auto_scan_minutes, SONDA_AUTO_SCAN_MINUTES, 0 turns it off)
Sonda takes the signature of each library, a hash of the names of everything in it folder
by folder, which costs only the names of the files and so suits a NAS that sleeps. A
library whose signature changed (a song or a folder came, went or was renamed) is
scanned the usual way; every library is also scanned at least once a day, to find a song
tagged again where it stands.

It does not scan while another scan runs, tries again at the next look when a scan failed,
leaves alone a folder that cannot be read (a NAS that is not mounted), and ignores the
housekeeping folders of a NAS.
squid merged commit 985bd3ed13 into main 2026-11-16 12:05:33 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
squid/sonda!36
No description provided.