@netlify/async-workloads
Advanced tools
Comparing version
@@ -17,5 +17,3 @@ import { | ||
import "./chunk-Z3PDUV4I.js"; | ||
import { | ||
waitAMoment | ||
} from "./chunk-QHZBJJIO.js"; | ||
import "./chunk-QHZBJJIO.js"; | ||
@@ -35,33 +33,3 @@ // src/functions/scheduler.ts | ||
console.log("Scheduler Start. Run ID:", schedulerRunId); | ||
await Promise.allSettled(availableProcessors.map(async (processorInfo) => { | ||
try { | ||
const start = Date.now(); | ||
let shouldRunProcessor = false; | ||
try { | ||
shouldRunProcessor = await processorInfo.shouldRun(); | ||
} catch (e) { | ||
console.error("should run failed"); | ||
console.error(e); | ||
} | ||
const startRun = Date.now(); | ||
console.log("State processor should run? ", shouldRunProcessor, processorInfo.name, `in ${startRun - start}ms`); | ||
if (shouldRunProcessor) { | ||
const url = new URL(`${SITE_URL}${processorInfo.path}`); | ||
url.searchParams.set("scheduler-run-id", schedulerRunId); | ||
fetch(url, { | ||
signal: AbortSignal.timeout(1e3 * 5) | ||
}).catch((e) => { | ||
console.error("processor fetch failure", url); | ||
console.error(e); | ||
}); | ||
await waitAMoment(); | ||
} | ||
} catch (error) { | ||
console.error(`Scheduler checked if it should run ${processorInfo.name} and it failed. It will not be ran.`); | ||
console.error(error); | ||
} | ||
})).catch((e) => { | ||
console.error("scheduler all settled failed."); | ||
console.error(e); | ||
}); | ||
console.log("do nothing"); | ||
console.log("Scheduler End. Run ID:", schedulerRunId); | ||
@@ -68,0 +36,0 @@ } |
{ | ||
"name": "@netlify/async-workloads", | ||
"version": "0.0.14", | ||
"version": "0.0.15", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "module": "index.js", |
88131
-1.28%2658
-1.19%