v1.5.7: environment-health diag batch + watchdog config
Adds four environment-health /api/diag/* endpoints that complement
the v1.5.6 regression-anchor set. Where the v1.5.6 endpoints guard
against past iplayer-arr code regressions, this batch verifies the
user's container is correctly configured to reach BBC infrastructure
and run reliably. Same auth pattern, same verdict: pass|fail JSON,
same Gitea-Actions gate location.
Also closes issue #42: ffmpeg progress-watchdog timeout is now
configurable (env var or store key), and the worker-pool default
adapts to host CPU count so small NAS hosts default to 2 workers
instead of 4. Helps the user class that was tripping the 60s watchdog
under concurrent grabs.
Highlights:
- feat(diag):
/api/diag/network— DNS + TCP-443 + HTTP-HEAD against
BBC Akamai, IBL, iPlayer-web + 1.1.1.1 canary. Surfaces
/etc/resolv.confandipv6_availablefor one-curl self-diagnosis
of the DNS/sinkhole class behind issue #40. - feat(diag):
/api/diag/storage— existence + writability + free
space + ownership + 2s NFS responsiveness on the configured
download_dir. Catches Docker bind-mount permission drift and
silent NFS detach. - feat(diag):
/api/diag/clock— HEAD-based drift vs Cloudflare /
Google / BBC with Cristian half-RTT correction. 60s threshold sits
well under Akamai's HLS-token tolerance so users get warning before
silent 403s. - feat(diag):
/api/diag/geo— wraps the runtime geo cache with TTL- optional
?refresh=1. Catches the VPN-exit-drifted-to-non-UK
failure mode.
- optional
- fix(download):
IPLAYER_ARR_WATCHDOG_TIMEOUT_SECONDSenv var and
watchdog_timeout_secondsstore key, precedence env > store > 60s
package default. Surfaced onGET /api/system. - change(download):
max_workersdefault is now
min(4, max(2, runtime.NumCPU()/2)). Existing explicit configs
unchanged. Newdownload.WithWatchdogTimeout(d)functional option
onNewManagerfor future tuning. - api(system):
GET /api/systemgainsmax_workersand
watchdog_timeout_secondsso operators can verify active runtime
config without reading logs.
Smoke-verified against real Sonarr on 192.168.1.57: all 9 diag
endpoints verdict: pass, identical hit counts vs prod indexer on a
MasterChef S22 interactive search, apikey threads through every
downloadUrl / guid in the release feed, end-to-end SAB-shim grab
exercised the worker-pool + MediaSelector + HLS variant resolution
- real ffmpeg HLS remux. The v1.5.6 ffmpeg stderr-tail filter is
visible in captured error output during a constrained-disk run.