About this project
This repository provides a keep-alive mechanism for a free Render web service. It combines a GitHub Actions workflow with a small Node.js script that issues periodic HTTP GET requests to a configured target URL, so the service does not fall asleep from inactivity.
Problem addressed: GitHub Actions' free scheduler can delay short cron intervals such as every 5 minutes when its servers are busy, leaving gaps between runs. Render free-tier services sleep after roughly 15 minutes without traffic, so missed pings can cause cold starts.
Approach described in the README:
- Active 14-minute session: each GitHub Actions job runs for about 14 minutes and sends a ping every 4 minutes (at 0, 4, 8, and 12 minutes).
- Multiple cron triggers: schedules such as */10 * * * * and 5,15,25,35,45,55 * * * * are used so new runner sessions keep launching.
- The stated goal is continuous coverage, since pings every 4 minutes within an active 14-minute window stay under the 15-minute inactivity threshold.
Features:
- Node.js 22 native APIs: uses built-in fetch() and node:timers/promises, with no external npm dependencies.
- Retry logic: retries up to 3 times with a 10-second delay on network errors or non-2xx responses.
- Console output: logs ISO UTC timestamps, HTTP status codes, response times in milliseconds, pass/fail results, and session cycle counts.
- Manual triggering: supports workflow_dispatch for immediate runs.
Configuration: the target URL is defined at the top of ping.js as TARGET_URL, currently pointing to a Render-hosted endpoint. Changing the endpoint requires editing that constant and pushing the change.
Deployment: the README instructs users to commit and push updated files to the main branch, after which GitHub Actions begins the active ping session.
Comments
0 Rating appears after 10 ratings
Sign in to join the discussion.