perf: parallelize WebSub notifications with 5s timeout
Build & Deploy / build-and-deploy (push) Failing after 10s

This commit is contained in:
svemagie
2026-05-11 09:30:03 +02:00
parent f4c2739ac7
commit ee8208ec12
+3 -2
View File
@@ -2179,18 +2179,19 @@ export default function (eleventyConfig) {
} }
console.log(`[websub] Notifying hub for ${feedUrls.length} URLs...`); console.log(`[websub] Notifying hub for ${feedUrls.length} URLs...`);
for (const feedUrl of feedUrls) { await Promise.all(feedUrls.map(async (feedUrl) => {
try { try {
const res = await fetch(hubUrl, { const res = await fetch(hubUrl, {
method: "POST", method: "POST",
headers: { "Content-Type": "application/x-www-form-urlencoded" }, headers: { "Content-Type": "application/x-www-form-urlencoded" },
body: `hub.mode=publish&hub.url=${encodeURIComponent(feedUrl)}`, body: `hub.mode=publish&hub.url=${encodeURIComponent(feedUrl)}`,
signal: AbortSignal.timeout(5000),
}); });
console.log(`[websub] Notified hub for ${feedUrl}: ${res.status}`); console.log(`[websub] Notified hub for ${feedUrl}: ${res.status}`);
} catch (err) { } catch (err) {
console.error(`[websub] Hub notification failed for ${feedUrl}:`, err.message); console.error(`[websub] Hub notification failed for ${feedUrl}:`, err.message);
} }
} }));
// Force garbage collection after post-build work completes. // Force garbage collection after post-build work completes.
// V8 doesn't return freed heap pages to the OS without GC pressure. // V8 doesn't return freed heap pages to the OS without GC pressure.