Archived
fix(entrypoint): arm cron worker via self-ping after boot
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).
This commit is contained in:
@@ -24,4 +24,21 @@ if [ ! -f "$DB" ]; then
|
|||||||
echo "[entrypoint] initialized $DB from seed snapshot"
|
echo "[entrypoint] initialized $DB from seed snapshot"
|
||||||
fi
|
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
|
exec node server.js
|
||||||
|
|||||||
Reference in New Issue
Block a user