[CORL-1239] Swap setTimeout for setLongTimeout (#3071)

* fix: ensure user editable time use setLongTimeout

* fix: fixed wrong type

* fix: fixed snapshots

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
Wyatt Johnson
2020-08-04 18:24:31 +00:00
committed by GitHub
co-authored by kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
parent 8aac2d33fc
commit 9d02391062
20 changed files with 55 additions and 60 deletions
+2 -1
View File
@@ -1,8 +1,9 @@
import AbortController from "abort-controller";
import { setLongTimeout } from "long-settimeout";
function abortAfter(ms: number) {
const controller = new AbortController();
const timeout = setTimeout(() => {
const timeout = setLongTimeout(() => {
controller.abort();
}, ms);
+2 -1
View File
@@ -1,6 +1,7 @@
import http from "http";
import https from "https";
import { capitalize } from "lodash";
import { clearLongTimeout } from "long-settimeout";
import fetch, { RequestInit, Response } from "node-fetch";
import { URL } from "url";
@@ -119,7 +120,7 @@ export const createFetch = ({
return res;
} finally {
clearTimeout(abort.timeout);
clearLongTimeout(abort.timeout);
}
};
};