Open AlissonRS opened 1 month ago
In the utils.ts file, the function below is used to send request via Fetch API:
const requestWrapper = (): Promise<Response> => { return new Promise((resolve, reject) => { let timeoutId: NodeJS.Timeout; if (timeout) { timeoutId = setTimeout(() => reject('error: timeout'), timeout); } return fetch(url, fetchOptions) .then(res => resolve(res)) .catch(err => reject(err)) .finally(() => { if (timeoutId) { clearTimeout(timeoutId); } }); }); };
This is timing out the promise, but not really aborting the request, which keeps http connections open hanging.
It'd be nice if abort signal was used so the http connection is also closed.
Thanks for raising this @AlissonRS, and submitting a PR. I've added a comment to the PR - let's continue the discussion there.
In the utils.ts file, the function below is used to send request via Fetch API:
This is timing out the promise, but not really aborting the request, which keeps http connections open hanging.
It'd be nice if abort signal was used so the http connection is also closed.