From 9e728583c4f508878050586a1a0f658b07ebddc2 Mon Sep 17 00:00:00 2001 From: ale Date: Thu, 26 Sep 2024 01:30:49 +0200 Subject: [PATCH] clearTimeout(timeout) --- lib/fediblock.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/fediblock.js b/lib/fediblock.js index 6d894bb..195f517 100644 --- a/lib/fediblock.js +++ b/lib/fediblock.js @@ -18,16 +18,17 @@ module.exports = async (client, apex, app) => { } }, requestPart = async uri => { - const ac = new AbortController() - setTimeout(() => { - ac.abort() - }, constant.abort_timeout) + const ac = new AbortController(), + timeout = setTimeout(() => { + ac.abort() + }, constant.abort_timeout) const response = await fetch(uri, { headers: { 'User-Agent': constant.agent }, signal: ac.signal, keepalive: false, timeout: constant.timeout, }) + clearTimeout(timeout) return await response.json() }, scanInstance = async instance => {