diff options
Diffstat (limited to 'server/helpers')
-rw-r--r-- | server/helpers/requests.ts | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/server/helpers/requests.ts b/server/helpers/requests.ts index fd2a56f30..d3c83d26e 100644 --- a/server/helpers/requests.ts +++ b/server/helpers/requests.ts | |||
@@ -2,7 +2,7 @@ import { createWriteStream, remove } from 'fs-extra' | |||
2 | import got, { CancelableRequest, Options as GotOptions, RequestError } from 'got' | 2 | import got, { CancelableRequest, Options as GotOptions, RequestError } from 'got' |
3 | import { join } from 'path' | 3 | import { join } from 'path' |
4 | import { CONFIG } from '../initializers/config' | 4 | import { CONFIG } from '../initializers/config' |
5 | import { ACTIVITY_PUB, PEERTUBE_VERSION, WEBSERVER } from '../initializers/constants' | 5 | import { ACTIVITY_PUB, PEERTUBE_VERSION, REQUEST_TIMEOUT, WEBSERVER } from '../initializers/constants' |
6 | import { pipelinePromise } from './core-utils' | 6 | import { pipelinePromise } from './core-utils' |
7 | import { processImage } from './image-utils' | 7 | import { processImage } from './image-utils' |
8 | import { logger } from './logger' | 8 | import { logger } from './logger' |
@@ -24,6 +24,7 @@ type PeerTubeRequestOptions = { | |||
24 | key: string | 24 | key: string |
25 | headers: string[] | 25 | headers: string[] |
26 | } | 26 | } |
27 | timeout?: number | ||
27 | jsonResponse?: boolean | 28 | jsonResponse?: boolean |
28 | } & Pick<GotOptions, 'headers' | 'json' | 'method' | 'searchParams'> | 29 | } & Pick<GotOptions, 'headers' | 'json' | 'method' | 'searchParams'> |
29 | 30 | ||
@@ -92,6 +93,10 @@ const peertubeGot = got.extend({ | |||
92 | path | 93 | path |
93 | }, httpSignatureOptions) | 94 | }, httpSignatureOptions) |
94 | } | 95 | } |
96 | }, | ||
97 | |||
98 | (options: GotOptions) => { | ||
99 | options.timeout = REQUEST_TIMEOUT | ||
95 | } | 100 | } |
96 | ] | 101 | ] |
97 | } | 102 | } |
@@ -182,6 +187,7 @@ function buildGotOptions (options: PeerTubeRequestOptions) { | |||
182 | method: options.method, | 187 | method: options.method, |
183 | json: options.json, | 188 | json: options.json, |
184 | searchParams: options.searchParams, | 189 | searchParams: options.searchParams, |
190 | timeout: options.timeout ?? REQUEST_TIMEOUT, | ||
185 | headers, | 191 | headers, |
186 | context | 192 | context |
187 | } | 193 | } |