Keep Render Service Alive #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Keep Render Service Alive | |
| on: | |
| schedule: | |
| # Run every 10 minutes | |
| - cron: '*/10 * * * *' | |
| workflow_dispatch: # Allow manual trigger | |
| jobs: | |
| keep-alive: | |
| runs-on: ubuntu-latest | |
| env: | |
| API_URL: ${{ secrets.API_URL }} | |
| steps: | |
| - name: Ping API Health Endpoint | |
| run: | | |
| echo "Pinging API to keep service awake..." | |
| response=$(curl -s -o /dev/null -w "%{http_code}" ${API_URL}/api/health) | |
| if [ $response -eq 200 ]; then | |
| echo "✅ Service is alive (HTTP $response)" | |
| else | |
| echo "⚠️ Service returned HTTP $response" | |
| exit 1 | |
| fi | |
| - name: Check Response Time | |
| run: | | |
| echo "Checking API response time..." | |
| start=$(date +%s%N) | |
| curl -s ${API_URL}/api/health > /dev/null | |
| end=$(date +%s%N) | |
| duration=$((($end - $start) / 1000000)) | |
| echo "Response time: ${duration}ms" | |
| if [ $duration -lt 5000 ]; then | |
| echo "✅ Fast response (<5s)" | |
| else | |
| echo "⚠️ Slow response (${duration}ms) - may be cold start" | |
| fi |