diff --git a/cspell.json b/cspell.json index 11be077..0e100ca 100644 --- a/cspell.json +++ b/cspell.json @@ -22,6 +22,7 @@ "caelia", "Calenelle", "callista", + "Chronara", "cashapp", "catz", "codeofdreams", @@ -32,6 +33,7 @@ "Deepgram", "Eclaire", "Eirene", + "Ephemere", "Elaria", "Elowyn", "Elunara", @@ -61,6 +63,7 @@ "manuarora", "maribelle", "minjo", + "Minori", "modeling", "maylin", "Meliora", @@ -87,6 +90,7 @@ "Ranjan", "Rennemeyer", "Rion", + "Rondelle", "roseaboveit", "rosalia", "ruus", @@ -103,6 +107,7 @@ "Sylvara", "Takada", "Taryne", + "Tatsumi", "Technomancer", "Tessara", "TTRPG", @@ -114,6 +119,7 @@ "Urmatan", "Umbrelle", "Vajda", + "Valerium", "Veluna", "verena", "vitalia", diff --git a/test/yaml.spec.ts b/test/yaml.spec.ts index 36a09d0..7eef248 100644 --- a/test/yaml.spec.ts +++ b/test/yaml.spec.ts @@ -14,14 +14,15 @@ import type { Projects } from "../src/interfaces/projects.js"; import type { Resume } from "../src/interfaces/resume.js"; import type { Testimonials } from "../src/interfaces/testimonials.js"; -const MAX_RETRIES = 3; -const RETRY_DELAY_MS = 2000; -const RATE_LIMIT_DELAY_MS = 5000; +const maxRetries = 3; +const retryDelayMs = 2000; +const rateLimitDelayMs = 5000; -const sleep = (milliseconds: number): Promise => - new Promise((resolve) => { +const sleep = (milliseconds: number): Promise => { + return new Promise((resolve) => { setTimeout(resolve, milliseconds); }); +}; const checkUrl = async(url: string, retries = 0): Promise => { try { @@ -32,17 +33,19 @@ const checkUrl = async(url: string, retries = 0): Promise => { if (response.ok) { return true; } - if (retries >= MAX_RETRIES) { + if (retries >= maxRetries) { return false; } - const delay = response.status === 429 ? RATE_LIMIT_DELAY_MS : RETRY_DELAY_MS; + const delay = response.status === 429 + ? rateLimitDelayMs + : retryDelayMs; console.log(`URL check failed for ${url} (${String(response.status)}), retrying in ${String(delay)}ms...`); await sleep(delay); return checkUrl(url, retries + 1); } catch (error) { console.error(`Error checking URL ${url}:`, error); - if (retries < MAX_RETRIES) { - await sleep(RETRY_DELAY_MS); + if (retries < maxRetries) { + await sleep(retryDelayMs); return checkUrl(url, retries + 1); } return false;