From ee8208ec1226ac275cea20cac6dd5bc3bef16f41 Mon Sep 17 00:00:00 2001 From: svemagie <869694+svemagie@users.noreply.github.com> Date: Mon, 11 May 2026 09:30:03 +0200 Subject: [PATCH] perf: parallelize WebSub notifications with 5s timeout --- eleventy.config.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/eleventy.config.js b/eleventy.config.js index 487f799..7646b18 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -2179,18 +2179,19 @@ export default function (eleventyConfig) { } console.log(`[websub] Notifying hub for ${feedUrls.length} URLs...`); - for (const feedUrl of feedUrls) { + await Promise.all(feedUrls.map(async (feedUrl) => { try { const res = await fetch(hubUrl, { method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded" }, body: `hub.mode=publish&hub.url=${encodeURIComponent(feedUrl)}`, + signal: AbortSignal.timeout(5000), }); console.log(`[websub] Notified hub for ${feedUrl}: ${res.status}`); } catch (err) { console.error(`[websub] Hub notification failed for ${feedUrl}:`, err.message); } - } + })); // Force garbage collection after post-build work completes. // V8 doesn't return freed heap pages to the OS without GC pressure.