From d8892e887565089091c39e8f6de8dcf06359d9cb Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 20 Sep 2024 10:59:00 +0200 Subject: [PATCH] Add timeout to requests --- server/helpers/requests.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/server/helpers/requests.ts b/server/helpers/requests.ts index 2b0ea8e..826d656 100644 --- a/server/helpers/requests.ts +++ b/server/helpers/requests.ts @@ -9,6 +9,7 @@ function doRequest ( if (!(requestOptions.headers)) requestOptions.headers = {} requestOptions.headers['User-Agent'] = `PeerTube search index (+${getWebserverUrl()})` + if (!requestOptions.timeout) requestOptions.timeout = 10000 return new Bluebird<{ response: request.RequestResponse, body: T }>((res, rej) => { request(requestOptions, (err, response, body) => err ? rej(err) : res({ response, body }))