Spaces:
Paused
Paused
refactor: update cron interval to 10 minutes and streamline keepalive request logging and handling
Browse filesFiles changed (2)
64 unmodified lines656667686970716869707180 unmodified lines15215315415815515615715864 unmodified lines}});
addEventListener("scheduled", (event) => {{ event.waitUntil((async () => {{ const result = await ping("cron"); console.log("Keepalive ping executed:", JSON.stringify(result)); }})()); event.waitUntil(ping("cron"));}});
const TARGET_URL = {json.dumps(target_url)};80 unmodified lines write_keepalive_status({"configured": False, "status": "skipped", "message": "SPACE_HOST could not be determined."}) return
cron = os.environ.get("CLOUDFLARE_KEEPALIVE_CRON", "* * * * *").strip() cron = os.environ.get("CLOUDFLARE_KEEPALIVE_CRON", "*/10 * * * *").strip() space_host = space_host.removeprefix("https://").removeprefix("http://").split("/")[0] target_url = os.environ.get("CLOUDFLARE_KEEPALIVE_URL", f"https://{space_host}/health").strip() worker_name = derive_keepalive_worker_name()530 unmodified lines531532533534535536534535536530 unmodified lines }
if (path === "/health" || path === `${APP_BASE}/health`) { if (req.headers["user-agent"] === "HuggingMess Cloudflare KeepAlive") { console.log(`[${new Date().toISOString()}] Received keepalive ping from Cloudflare.`); } const data = await statusPayload(); res.writeHead(data.ok ? 200 : 503, { "content-type": "application/json" }); res.end(cloudflare-keepalive-setup.py+2-5
health-server.js-3