From 193673a9ceed8069f264d0fa92b69d9eb79e82be Mon Sep 17 00:00:00 2001 From: grabowski Date: Wed, 1 Jul 2026 11:44:36 +0700 Subject: [PATCH] Fix flaky deploy health check: poll instead of fixed 2s sleep The service can take longer than 2s to finish starting after restart (DB pool init, etc), so systemctl is-active would occasionally still report "activating" at the fixed check point -- CI marked the run failed even though the app came up moments later and was actually fine. Poll for up to 15s instead, and dump service status on a real failure so debugging doesn't require SSH access. --- .gitea/workflows/deploy.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 4ba0efa..862eee3 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -62,5 +62,14 @@ jobs: sudo systemctl restart bflr echo "==> Waiting for startup..." - sleep 2 - systemctl is-active --quiet bflr && echo "Deploy successful!" || (echo "Service failed to start!" && exit 1) + for i in $(seq 1 15); do + if systemctl is-active --quiet bflr; then + echo "Deploy successful!" + exit 0 + fi + sleep 1 + done + + echo "Service failed to start!" + sudo systemctl status bflr --no-pager -l || true + exit 1