feat(scripts): add uptime-check retry + Obsidian variant, add LLM benchmark docs
check_uptime.js gets a fetchWithRetry wrapper (3 attempts, 2s backoff) for transient failures against the status page/heartbeat API. check_uptime_to_obsidian.js is a variant that logs results into the Obsidian vault instead of stdout. Also adds two benchmark writeups (gpt-oss-20b on Ollama, 73-node Ollama fleet). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
1792dd964b
commit
10997e4b16
+19
-2
@@ -1,10 +1,27 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
async function fetchWithRetry(url, options = {}, retries = 3, backoff = 2000) {
|
||||
for (let i = 0; i < retries; i++) {
|
||||
try {
|
||||
const response = await fetch(url, options);
|
||||
if (response.ok) return response;
|
||||
if (response.status >= 500) {
|
||||
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
||||
}
|
||||
return response;
|
||||
} catch (err) {
|
||||
if (i === retries - 1) throw err;
|
||||
console.warn(`Fetch to ${url} failed (attempt ${i + 1}/${retries}): ${err.message}. Retrying in ${backoff}ms...`);
|
||||
await new Promise(resolve => setTimeout(resolve, backoff));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function checkStatus() {
|
||||
try {
|
||||
// 1. Fetch status page HTML
|
||||
const htmlResponse = await fetch('https://uptime.ginnoir.com/status/default');
|
||||
const htmlResponse = await fetchWithRetry('https://uptime.ginnoir.com/status/default');
|
||||
if (!htmlResponse.ok) {
|
||||
throw new Error(`Failed to fetch status page: ${htmlResponse.statusText}`);
|
||||
}
|
||||
@@ -34,7 +51,7 @@ async function checkStatus() {
|
||||
}
|
||||
|
||||
// 2. Fetch heartbeat JSON
|
||||
const heartbeatResponse = await fetch('https://uptime.ginnoir.com/api/status-page/heartbeat/default');
|
||||
const heartbeatResponse = await fetchWithRetry('https://uptime.ginnoir.com/api/status-page/heartbeat/default');
|
||||
if (!heartbeatResponse.ok) {
|
||||
throw new Error(`Failed to fetch heartbeat: ${heartbeatResponse.statusText}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user