Fix NAS stats returning zeros instead of real download numbers
Two independent bugs, either of which made gather_castopod() report total_downloads: 0 on a dev machine — indistinguishable from a podcast nobody listens to. - NAS_SSH hardcoded mmgnas-10g, which is only reachable when the 10G cable is physically connected. Now probed once per process with a 2s timeout and falls back to mmgnas; NAS_HOST overrides detection entirely. Same detection added to deploy_stats_cron.sh. - _run_db_query treated any docker binary on PATH as "running on the NAS", so a machine with Docker Desktop queried its own daemon, found no castopod container, and never fell back to SSH. Only the QNAP container-station path counts now. Real figures with both fixed: 3803 downloads, 750 unique listeners. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+13
-1
@@ -5,9 +5,21 @@
|
||||
|
||||
set -e
|
||||
|
||||
NAS_HOST="mmgnas-10g"
|
||||
NAS_USER="luke"
|
||||
NAS_PORT="8001"
|
||||
|
||||
# mmgnas-10g is only up when the 10G cable is physically connected. Prefer it
|
||||
# when reachable (faster transfers), otherwise fall back to the wireless/1G
|
||||
# host. Override with NAS_HOST=... to skip detection.
|
||||
if [ -z "$NAS_HOST" ]; then
|
||||
if ssh -p "$NAS_PORT" -o ConnectTimeout=2 -o BatchMode=yes \
|
||||
"$NAS_USER@mmgnas-10g" true 2>/dev/null; then
|
||||
NAS_HOST="mmgnas-10g"
|
||||
else
|
||||
NAS_HOST="mmgnas"
|
||||
fi
|
||||
echo "NAS host: $NAS_HOST"
|
||||
fi
|
||||
DOCKER_BIN="/share/CACHEDEV1_DATA/.qpkg/container-station/bin/docker"
|
||||
DEPLOY_DIR="/share/CACHEDEV1_DATA/podcast-stats"
|
||||
CONTAINER_NAME="podcast-stats"
|
||||
|
||||
Reference in New Issue
Block a user