This commit is contained in:
Yann MAHE 2025-12-04 10:02:26 -05:00
parent a1a1965d2b
commit 7f201e6e59

View file

@ -211,26 +211,16 @@ SERVER_PID=$!
log "✓ Dev server started with PID $SERVER_PID" log "✓ Dev server started with PID $SERVER_PID"
# 7. Warm up the main application routes # 7. Warm up the main application routes
# We poll until the dev server responds, up to a configurable timeout. This # Use a single blocking curl to capture an accurate "dev run -> preview ready"
# gives us a concrete "dev run -> preview ready" duration that callers can # duration while still honoring a configurable max wait.
# use for more granular sandbox timing analysis.
MAX_DEV_WAIT_SECONDS=${UMAMI_DEV_WAIT_SECONDS:-60} MAX_DEV_WAIT_SECONDS=${UMAMI_DEV_WAIT_SECONDS:-60}
log "Warming up main application routes (up to ${MAX_DEV_WAIT_SECONDS}s)..." log "Warming up main application routes (max ${MAX_DEV_WAIT_SECONDS}s)..."
DEV_SERVER_READY=0 if curl -s -o /dev/null --max-time "${MAX_DEV_WAIT_SECONDS}" http://localhost:3001/ 2>/dev/null; then
for ((i=1; i<=MAX_DEV_WAIT_SECONDS; i++)); do DEV_SERVER_TO_PREVIEW_DURATION_S=$((SECONDS - DEV_PHASE_START_SECONDS))
if curl -s -o /dev/null --max-time 5 http://localhost:3001/ 2>/dev/null; then
DEV_SERVER_READY=1
break
fi
sleep 1
done
DEV_SERVER_TO_PREVIEW_DURATION_S=$((SECONDS - DEV_PHASE_START_SECONDS))
if [[ "$DEV_SERVER_READY" -eq 1 ]]; then
log "✓ Main routes pre-compiled (ready after ${DEV_SERVER_TO_PREVIEW_DURATION_S}s)" log "✓ Main routes pre-compiled (ready after ${DEV_SERVER_TO_PREVIEW_DURATION_S}s)"
else else
log "Warning: Route warm-up timed out after ${DEV_SERVER_TO_PREVIEW_DURATION_S}s (non-critical)" DEV_SERVER_TO_PREVIEW_DURATION_S=$((SECONDS - DEV_PHASE_START_SECONDS))
log "Warning: Route warm-up failed or timed out after ${DEV_SERVER_TO_PREVIEW_DURATION_S}s (non-critical)"
fi fi
log "" log ""