From 03af3574ff43aecf62fae79c3355b85860cfdfd1 Mon Sep 17 00:00:00 2001 From: eenvin Date: Mon, 27 Nov 2023 18:21:16 +0100 Subject: [PATCH 1/2] refactor(tiemout): increase timeout for requests --- packages/ptokens-helpers/src/http/http-utils.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/ptokens-helpers/src/http/http-utils.ts b/packages/ptokens-helpers/src/http/http-utils.ts index 1fe9edc7..cc6ed44b 100644 --- a/packages/ptokens-helpers/src/http/http-utils.ts +++ b/packages/ptokens-helpers/src/http/http-utils.ts @@ -1,7 +1,7 @@ import fetch from 'cross-fetch' import { ERROR_JSON_RESPONSE_EXTRACTION, ERROR_UNEXPECTED_HTTP_STATUS } from '../errors' -export async function postRequest(_url: string, _body, _headers: HeadersInit | undefined = {}, _timeout = 2000) { +export async function postRequest(_url: string, _body, _headers: HeadersInit | undefined = {}, _timeout = 10000) { const controller = new AbortController() const timeout = setTimeout(() => { controller.abort() @@ -24,7 +24,7 @@ export async function postRequest(_url: string, _body, _headers: HeadersInit | u } } -export async function getRequest(_url: string, _headers: HeadersInit | undefined = {}, _timeout = 2000) { +export async function getRequest(_url: string, _headers: HeadersInit | undefined = {}, _timeout = 10000) { const controller = new AbortController() const timeout = setTimeout(() => { controller.abort() @@ -61,7 +61,7 @@ function checkResponseStatus(_resp: Response) { export async function fetchJsonByGet( _url: string, _headers: HeadersInit | undefined = {}, - _timeout = 2000 + _timeout = 10000 ): Promise { const resp = await getRequest(_url, _headers, _timeout) checkResponseStatus(resp) @@ -72,7 +72,7 @@ export async function fetchJsonByPost( _url: string, _body, _headers: HeadersInit | undefined = { 'Content-Type': 'application/json' }, - _timeout = 2000 + _timeout = 10000 ): Promise { const resp = await postRequest(_url, _body, _headers, _timeout) checkResponseStatus(resp) From d23e34bd1f1439d7988159db1b757f62a4da49d7 Mon Sep 17 00:00:00 2001 From: eenvin Date: Tue, 28 Nov 2023 18:02:42 +0100 Subject: [PATCH 2/2] chore(version): bump version --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index 5aa951ca..03a6c3a5 100644 --- a/lerna.json +++ b/lerna.json @@ -1,4 +1,4 @@ { "packages": ["packages/*"], - "version": "1.7.0" + "version": "1.7.1" }