From 6141140beb5bba2551455c159c7dd63e404907ac Mon Sep 17 00:00:00 2001 From: grabowski Date: Wed, 13 Aug 2025 13:34:44 +0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Improve=20health=20check=20robus?= =?UTF-8?q?tness=20and=20timing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🕐 Enhanced Timing: - Increase attempts from 12 to 15 - Increase wait time from 10 to 15 seconds between attempts - Add longer curl timeouts (10s max, 5s connect) 🔍 Better Debugging: - More verbose health check logging - Show container status on each failed attempt - Clearer success/failure messages - Track attempt progress (X/15) 🌐 Improved Curl Options: - --max-time 10: Overall timeout - --connect-timeout 5: Connection timeout - -s: Silent mode (less noise) - -f: Fail on HTTP errors 🎯 Addresses Race Condition: - Container shows as healthy but curl fails immediately - Longer waits allow application full startup - Better visibility into what's happening during checks ✅ Should resolve timing issues with container startup --- .gitea/workflows/release.yml | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 12a02d3..714158f 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -218,14 +218,21 @@ jobs: echo "📋 Recent container logs:" docker logs --tail 10 ping-river-monitor-test || true - # Wait for the application to be ready - for i in {1..12}; do - if curl -f http://127.0.0.1:8080/health; then - echo "✅ Health endpoint responding" + # Wait for the application to be ready with more robust checking + echo "🔍 Testing application readiness..." + for i in {1..15}; do + echo "⏳ Attempt $i/15: Testing health endpoint..." + + # Use curl with more verbose output and longer timeout + if curl -f -s --max-time 10 --connect-timeout 5 http://127.0.0.1:8080/health; then + echo "✅ Health endpoint responding successfully!" break else - echo "⏳ Waiting for health endpoint... (attempt $i/12)" - sleep 10 + echo "❌ Health check failed, waiting 15 seconds..." + # Show what's happening with the container + echo "Container status:" + docker ps | grep ping-river-monitor-test || echo "Container not found" + sleep 15 fi done