Skip to content

Keep backend warm

Keep backend warm #413

Workflow file for this run

name: Keep backend warm
# Render's free tier spins the service down after ~15 min idle, causing a ~40s
# cold start on the next request (users saw auth timeouts + "cannot reach server").
# This pings the health endpoint on a schedule so the instance stays awake.
on:
schedule:
- cron: "*/10 * * * *" # every 10 minutes
workflow_dispatch: {}
jobs:
ping:
runs-on: ubuntu-latest
steps:
- name: Ping health endpoint
run: |
for i in 1 2 3; do
STATUS=$(curl -s -m 60 -o /dev/null -w "%{http_code}" https://archmind-ai.onrender.com/api/health)
if [ "$STATUS" = "200" ]; then
echo "Backend awake (HTTP $STATUS)"
exit 0
fi
echo "Attempt $i: HTTP $STATUS — retrying in 20s"
sleep 20
done
echo "Backend did not respond 200 after 3 attempts"
exit 1