Skip to content

Commit d719520

Browse files
committed
Update keep-render-alive workflow to change cron schedule and enhance ping command verbosity
1 parent 588e611 commit d719520

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

.github/workflows/keep-render-alive.yml

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ name: Keep Render Services Alive
22

33
on:
44
schedule:
5-
- cron: '*/2 * * * *'
5+
- cron: '*/5 * * * *'
6+
workflow_dispatch:
67
push:
78
branches:
89
- main
@@ -13,18 +14,32 @@ jobs:
1314
runs-on: ubuntu-latest
1415
steps:
1516
- name: Ping API Gateway
17+
id: ping-api
1618
run: |
17-
curl -X POST https://codebrewery-api-gateway.onrender.com/execute \
19+
echo "Sending ping to API Gateway..."
20+
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" -X POST https://codebrewery-api-gateway.onrender.com/execute \
1821
-H "Content-Type: application/json" \
19-
-d '{"language":"python","code":"print(\"Keeping service alive\")"}' \
20-
-v || echo "API Gateway ping sent"
22+
-d '{"language":"python","code":"print(\"Keeping service alive\")"}')
23+
echo "Received status code: $HTTP_STATUS"
24+
if [[ "$HTTP_STATUS" -ge 200 && "$HTTP_STATUS" -lt 300 ]]; then
25+
echo "API Gateway ping successful!"
26+
else
27+
echo "::warning::API Gateway ping returned status code $HTTP_STATUS"
28+
fi
2129
2230
- name: Ping Code Execution Service
31+
id: ping-execution
2332
run: |
24-
curl -X POST https://codebrewery-code-execution-service.onrender.com/execute \
33+
echo "Sending ping to Code Execution Service..."
34+
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" -X POST https://codebrewery-code-execution-service.onrender.com/execute \
2535
-H "Content-Type: application/json" \
26-
-d '{"language":"python","code":"print(\"Keeping service alive\")"}' \
27-
-v || echo "Code Execution Service ping sent"
36+
-d '{"language":"python","code":"print(\"Keeping service alive\")"}')
37+
echo "Received status code: $HTTP_STATUS"
38+
if [[ "$HTTP_STATUS" -ge 200 && "$HTTP_STATUS" -lt 300 ]]; then
39+
echo "Code Execution Service ping successful!"
40+
else
41+
echo "::warning::Code Execution Service ping returned status code $HTTP_STATUS"
42+
fi
2843
2944
- name: Timestamp
3045
run: echo "Services pinged at $(date)"

0 commit comments

Comments
 (0)