Fix false-positive stale-mount detection in nfs-mount-heal.sh

find -maxdepth 3 couldn't reach immich's thumbs/<uuid>/XX/YY/file (4
levels deep), so it exhausted the 256x256 hash-bucket fan-out with no
match and timed out on every run -- 3 spurious remounts/restarts of
immich_server within 15 minutes of deploy, all falsely alerted as
staleness. Drop -maxdepth entirely; -quit already stops at the first
match via depth-first search, so it's fast regardless of tree depth.
This commit is contained in:
2026-08-25 22:06:43 +00:00
parent 42a31b6a44
commit 50a5a48ed4
@@ -30,7 +30,13 @@ alert() {
healthy() {
local testdir="$1"
local f
f=$(timeout 10 find "$testdir" -maxdepth 3 -type f -print -quit 2>/dev/null) || return 1
# No -maxdepth: -quit stops at the first match via depth-first search,
# so this is fast regardless of tree depth. A maxdepth that's too
# shallow for the actual file depth (e.g. immich's thumbs/<uuid>/XX/YY/
# file is 4 levels deep) makes find exhaust a huge fan-out with no
# match and time out -- a false positive, not real staleness (hit in
# production 2026-08-25, 3 spurious remounts in 15 min).
f=$(timeout 10 find "$testdir" -type f -print -quit 2>/dev/null) || return 1
[ -n "$f" ] || return 1
timeout 10 cat "$f" > /dev/null 2>&1
}