From 0dda19607d18547219eb03100407569aa8f4a603 Mon Sep 17 00:00:00 2001 From: ghe Date: Wed, 6 Jul 2022 13:35:56 +0100 Subject: [PATCH 1/3] fix: do not retry 404s --- src/lib/request/requestManager.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/request/requestManager.ts b/src/lib/request/requestManager.ts index 7645d6e..64033a4 100644 --- a/src/lib/request/requestManager.ts +++ b/src/lib/request/requestManager.ts @@ -117,7 +117,10 @@ class RequestsManager { requestId, ); const alreadyRetriedCount = this._retryCounter.get(requestId) || 0; - if (alreadyRetriedCount >= this._MAX_RETRY_COUNT) { + if ( + err?.name === 'NotFoundError' || + alreadyRetriedCount >= this._MAX_RETRY_COUNT + ) { this._emit({ eventType: eventType.error, channel: request.channel, From 85526dd6af2b02242a2a8403ce611cb010d64187 Mon Sep 17 00:00:00 2001 From: ghe Date: Thu, 4 Aug 2022 12:18:57 +0100 Subject: [PATCH 2/3] feat: upgrade axios to 0.27.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5f4ba8b..bc16e3e 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "@snyk/configstore": "^3.2.0-rc1", "@types/debug": "^4.1.7", "@types/uuid": "^7.0.3", - "axios": "0.21.4", + "axios": "0.27.2", "chalk": "^4.0.0", "debug": "^4.1.1", "global-agent": "3.0.0", From d08d6cb84ecd4fa7fe47c07f4f25851f78e0a005 Mon Sep 17 00:00:00 2001 From: ghe Date: Thu, 4 Aug 2022 12:19:41 +0100 Subject: [PATCH 3/3] fix: enable requests timeout after 5mins --- src/lib/request/request.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lib/request/request.ts b/src/lib/request/request.ts index 4429f69..1ab7bfe 100644 --- a/src/lib/request/request.ts +++ b/src/lib/request/request.ts @@ -50,6 +50,10 @@ const makeSnykRequest = async ( baseURL: request.useRESTApi ? apiUrlREST : apiUrl, responseType: 'json', headers: { ...requestHeaders, ...request.headers }, + transitional: { + clarifyTimeoutError: true, + }, + timeout: 30_000, // 5 mins same as Snyk APIs }); try {