fix: move clearTimeout to finally()

This commit is contained in:
Yarmo Mackenbach 2024-01-23 19:58:26 +01:00
parent c02742e041
commit a9c1ffabfe
No known key found for this signature in database
GPG key ID: C248C28D432560ED
10 changed files with 10 additions and 20 deletions

View file

@ -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) clearTimeout(timeoutHandle)
return result
}) })
} }

View file

@ -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) clearTimeout(timeoutHandle)
return result
}) })
} }

View file

@ -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) clearTimeout(timeoutHandle)
return result
}) })
} }

View file

@ -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) clearTimeout(timeoutHandle)
return result
}) })
} }

View file

@ -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) clearTimeout(timeoutHandle)
return result
}) })
} }

View file

@ -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) clearTimeout(timeoutHandle)
return result
}) })
} }

View file

@ -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) clearTimeout(timeoutHandle)
return result
}) })
} }

View file

@ -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) clearTimeout(timeoutHandle)
return result
}) })
} }

View file

@ -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) clearTimeout(timeoutHandle)
return result
}) })
} }

View file

@ -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) clearTimeout(timeoutHandle)
return result
}) })
} }