Guard arr cache writes against in-flight rescans, add rescan monitor tool
A direct arr_cache_write() call mid-rescan wrote a partial snapshot that looked like real data loss to every consumer of the cache. The guard now lives in arr_cache_write() itself so every caller is protected, not just arr_get_tracked_data(). arr_rescan_monitor.sh closes the resulting gap for rescans triggered outside arr_full_rescan.sh's own trigger-and-wait path.
This commit is contained in:
+12
-1
@@ -49,6 +49,15 @@ inconsistent backup, and tar without stopping the container is equally unreliabl
|
||||
Fix: `container_data_export.sh` — stops the container cleanly, archives appdata to a
|
||||
timestamped `.tar.gz`, verifies archive integrity, restarts the container.
|
||||
|
||||
**Manually Kicked Off a Rescan and the Cache Never Caught Up**
|
||||
Triggered a Lidarr `RescanFolders` by hand to fix a stats-drift problem. It ran for two
|
||||
hours. `arr_cache_write()` correctly refuses to write while a rescan's active (2026-07-17 —
|
||||
a mid-scan write once looked exactly like real data loss to every script trusting the
|
||||
cache), but that means nothing writes the real post-scan number through once it finishes,
|
||||
unless something was watching for completion.
|
||||
Fix: `arr_rescan_monitor.sh` — waits for the arr's active rescan to finish, then refreshes
|
||||
its cache with the real number.
|
||||
|
||||
---
|
||||
|
||||
## ━━━ WHAT THIS FOLDER DOES ━━━
|
||||
@@ -66,7 +75,7 @@ something new, write the tool. Store it here. Find it at 2am next time.
|
||||
`emby_database_repair.sh`, `zfs_pool_scrub.sh`, `smart_long_test.sh`
|
||||
|
||||
**Repair Tools** — Fix a specific known problem
|
||||
`bulk_permissions_repair.sh`, `arr_profile_enforcer.sh`
|
||||
`bulk_permissions_repair.sh`, `arr_profile_enforcer.sh`, `arr_rescan_monitor.sh`
|
||||
|
||||
**Lifecycle Tools** — Backup, setup, and migration support
|
||||
`container_data_export.sh`, `ramdisk_stop.sh`, `webhook_setup.sh`
|
||||
@@ -117,6 +126,7 @@ The relationship is one-way: Tools act on state that other scripts have written.
|
||||
| `ramdisk_stop.sh` | Safely stop the transcode ramdisk — redirect symlink to SSD, unmount, update state | Before re-running ramdisk_setup.sh with new size or thresholds |
|
||||
| `arr_profile_enforcer.sh` | Enforce correct quality profiles across all Sonarr/Radarr libraries | After arr setup, profile changes, or when library was imported with wrong profile |
|
||||
| `webhook_setup.sh` | Register the Varaverk upgrade webhook in Sonarr, Radarr, and Lidarr | After initial install or when adding a new arr or host |
|
||||
| `arr_rescan_monitor.sh` | Shared tracked-data cache stuck stale after a manually-triggered rescan | After manually kicking off a RescanFolders/RescanSeries/RescanMovie outside arr_full_rescan.sh |
|
||||
| `emby_to_lidarr_sync.sh` | Add all Emby album artists not yet tracked in Lidarr | After Lidarr setup, database wipe, or when you suspect gaps |
|
||||
| `emby_to_sonarr_sync.sh` | Add all Emby TV series not yet tracked in Sonarr | After Sonarr setup, database wipe, or when you suspect gaps |
|
||||
| `emby_to_radarr_sync.sh` | Add all Emby movies not yet tracked in Radarr | After Radarr setup, database wipe, or when you suspect gaps |
|
||||
@@ -144,6 +154,7 @@ Situation arises
|
||||
│ arr_profile_enforcer ◄── wrong profiles after import or setup │
|
||||
│ webhook_setup ◄── after install or adding a new arr │
|
||||
│ ramdisk_stop ◄── before ramdisk resize / remount │
|
||||
│ arr_rescan_monitor ◄── after manually triggering a rescan │
|
||||
│ │
|
||||
│ emby_to_lidarr_sync ◄── Lidarr setup / database wipe / gap │
|
||||
│ emby_to_sonarr_sync ◄── Sonarr setup / database wipe / gap │
|
||||
|
||||
Reference in New Issue
Block a user