From a9c1ffabfe3925623d738911ef5bbf2232acb79d Mon Sep 17 00:00:00 2001 From: Yarmo Mackenbach Date: Tue, 23 Jan 2024 19:58:26 +0100 Subject: [PATCH] fix: move clearTimeout to finally() --- src/fetcher/activitypub.js | 3 +-- src/fetcher/aspe.js | 3 +-- src/fetcher/dns.js | 3 +-- src/fetcher/graphql.js | 3 +-- src/fetcher/http.js | 3 +-- src/fetcher/irc.js | 3 +-- src/fetcher/matrix.js | 3 +-- src/fetcher/openpgp.js | 3 +-- src/fetcher/telegram.js | 3 +-- src/fetcher/xmpp.js | 3 +-- 10 files changed, 10 insertions(+), 20 deletions(-) diff --git a/src/fetcher/activitypub.js b/src/fetcher/activitypub.js index 8809b57..7a470f4 100644 --- a/src/fetcher/activitypub.js +++ b/src/fetcher/activitypub.js @@ -89,8 +89,7 @@ export async function fn (data, opts) { })() }) - return Promise.race([fetchPromise, timeoutPromise]).then((result) => { + return Promise.race([fetchPromise, timeoutPromise]).finally(() => { clearTimeout(timeoutHandle) - return result }) } diff --git a/src/fetcher/aspe.js b/src/fetcher/aspe.js index 14c0bc1..4775db1 100644 --- a/src/fetcher/aspe.js +++ b/src/fetcher/aspe.js @@ -70,8 +70,7 @@ export async function fn (data, opts) { }) }) - return Promise.race([fetchPromise, timeoutPromise]).then((result) => { + return Promise.race([fetchPromise, timeoutPromise]).finally(() => { clearTimeout(timeoutHandle) - return result }) } diff --git a/src/fetcher/dns.js b/src/fetcher/dns.js index 1cd53a7..2c5eecd 100644 --- a/src/fetcher/dns.js +++ b/src/fetcher/dns.js @@ -56,8 +56,7 @@ export async function fn (data, opts) { }) }) - return Promise.race([fetchPromise, timeoutPromise]).then((result) => { + return Promise.race([fetchPromise, timeoutPromise]).finally(() => { clearTimeout(timeoutHandle) - return result }) } diff --git a/src/fetcher/graphql.js b/src/fetcher/graphql.js index a140916..15d544f 100644 --- a/src/fetcher/graphql.js +++ b/src/fetcher/graphql.js @@ -68,8 +68,7 @@ export async function fn (data, opts) { }) }) - return Promise.race([fetchPromise, timeoutPromise]).then((result) => { + return Promise.race([fetchPromise, timeoutPromise]).finally(() => { clearTimeout(timeoutHandle) - return result }) } diff --git a/src/fetcher/http.js b/src/fetcher/http.js index d18a93b..0421772 100644 --- a/src/fetcher/http.js +++ b/src/fetcher/http.js @@ -83,8 +83,7 @@ export async function fn (data, opts) { } }) - return Promise.race([fetchPromise, timeoutPromise]).then((result) => { + return Promise.race([fetchPromise, timeoutPromise]).finally(() => { clearTimeout(timeoutHandle) - return result }) } diff --git a/src/fetcher/irc.js b/src/fetcher/irc.js index 5c7aeb3..fa55200 100644 --- a/src/fetcher/irc.js +++ b/src/fetcher/irc.js @@ -80,8 +80,7 @@ export async function fn (data, opts) { } }) - return Promise.race([fetchPromise, timeoutPromise]).then((result) => { + return Promise.race([fetchPromise, timeoutPromise]).finally(() => { clearTimeout(timeoutHandle) - return result }) } diff --git a/src/fetcher/matrix.js b/src/fetcher/matrix.js index ab01711..0baf11d 100644 --- a/src/fetcher/matrix.js +++ b/src/fetcher/matrix.js @@ -72,8 +72,7 @@ export async function fn (data, opts) { }) }) - return Promise.race([fetchPromise, timeoutPromise]).then((result) => { + return Promise.race([fetchPromise, timeoutPromise]).finally(() => { clearTimeout(timeoutHandle) - return result }) } diff --git a/src/fetcher/openpgp.js b/src/fetcher/openpgp.js index f28c929..982a477 100644 --- a/src/fetcher/openpgp.js +++ b/src/fetcher/openpgp.js @@ -104,8 +104,7 @@ export async function fn (data, opts) { } }) - return Promise.race([fetchPromise, timeoutPromise]).then((result) => { + return Promise.race([fetchPromise, timeoutPromise]).finally(() => { clearTimeout(timeoutHandle) - return result }) } diff --git a/src/fetcher/telegram.js b/src/fetcher/telegram.js index 4d3e011..00fe7f1 100644 --- a/src/fetcher/telegram.js +++ b/src/fetcher/telegram.js @@ -99,8 +99,7 @@ export async function fn (data, opts) { }) }) - return Promise.race([fetchPromise, timeoutPromise]).then((result) => { + return Promise.race([fetchPromise, timeoutPromise]).finally(() => { clearTimeout(timeoutHandle) - return result }) } diff --git a/src/fetcher/xmpp.js b/src/fetcher/xmpp.js index 01cc5c6..88a0d2d 100644 --- a/src/fetcher/xmpp.js +++ b/src/fetcher/xmpp.js @@ -176,8 +176,7 @@ export async function fn (data, opts) { })() }) - return Promise.race([fetchPromise, timeoutPromise]).then((result) => { + return Promise.race([fetchPromise, timeoutPromise]).finally(() => { clearTimeout(timeoutHandle) - return result }) }