-
Notifications
You must be signed in to change notification settings - Fork 0
27 lines (25 loc) · 901 Bytes
/
Copy pathkeep-warm.yml
File metadata and controls
27 lines (25 loc) · 901 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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