aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/requests.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/requests.ts')
-rw-r--r--server/helpers/requests.ts8
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'
2import got, { CancelableRequest, Options as GotOptions, RequestError } from 'got' 2import got, { CancelableRequest, Options as GotOptions, RequestError } from 'got'
3import { join } from 'path' 3import { join } from 'path'
4import { CONFIG } from '../initializers/config' 4import { CONFIG } from '../initializers/config'
5import { ACTIVITY_PUB, PEERTUBE_VERSION, WEBSERVER } from '../initializers/constants' 5import { ACTIVITY_PUB, PEERTUBE_VERSION, REQUEST_TIMEOUT, WEBSERVER } from '../initializers/constants'
6import { pipelinePromise } from './core-utils' 6import { pipelinePromise } from './core-utils'
7import { processImage } from './image-utils' 7import { processImage } from './image-utils'
8import { logger } from './logger' 8import { 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 }