From 92373aa3c6a9167c889148320ee11daaae41d0e0 Mon Sep 17 00:00:00 2001 From: krisf Date: Tue, 18 Aug 2026 11:22:12 -0400 Subject: [PATCH] fix(entrypoint): arm cron worker via self-ping after boot MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit instrumentationHook is disabled in the standalone build, so node-cron only arms on POST /api/worker/ping. Without a self-ping, a fresh container or restart runs zero ingest passes (worker silently never armed) — exactly what happened on the :8 deploy. Adds the same self-ping block as technews/finance entrypoints (identical). --- entrypoint.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index 86fbac5..14c69d2 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -24,4 +24,21 @@ if [ ! -f "$DB" ]; then echo "[entrypoint] initialized $DB from seed snapshot" fi +# Arm the ingest/synthesis worker once the server answers. +# The Next standalone build has instrumentationHook disabled, so node-cron +# only starts when a request reaches /api/worker/ping. Pinging ourselves +# after boot means a fresh container or restart re-arms the worker (and +# triggers the boot pipeline pass) without any external health pinger. +( + APP_IP="$(hostname -i 2>/dev/null | awk '{print $1}')" + [ -z "$APP_IP" ] && APP_IP=127.0.0.1 + i=0 + until curl -sf -o /dev/null --max-time 2 "http://${APP_IP}:${PORT:-3000}/api/worker/ping"; do + i=$((i + 1)) + [ "$i" -ge 90 ] && exit 0 + sleep 1 + done + echo "[entrypoint] armed cron worker via /api/worker/ping" +) >/dev/null 2>&1 & + exec node server.js