From 0fbd1ded7fb26e23b06cdf7a337c1f2c7205efb3 Mon Sep 17 00:00:00 2001 From: Okiki Ojo Date: Sat, 6 Jun 2026 05:47:28 +0000 Subject: [PATCH] fix(fetch): cancel response body to prevent in-flight request count in Cloudflare Signed-off-by: Okiki Ojo --- utils/fetch-and-cache.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/utils/fetch-and-cache.ts b/utils/fetch-and-cache.ts index 46f8fe4..8b92900 100644 --- a/utils/fetch-and-cache.ts +++ b/utils/fetch-and-cache.ts @@ -588,6 +588,10 @@ export async function fetchHeaders( }); const contentType = response.headers.get("content-type"); + + // We only need headers from the HEAD probe. Explicitly cancel the response + // so Cloudflare does not keep the request counted as in-flight. + try { await response.body?.cancel(); } catch { /* ignore cancel errors */ } return { url: finalUrl, contentType, fromCache }; } catch (_) { -- knotmirror 0.0.1