1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-06 03:50:26 +02:00

Fix redundancy timeout

This commit is contained in:
Chocobozzz 2021-11-29 15:45:02 +01:00
parent c5e53d0e39
commit 4c99953acd
No known key found for this signature in database
GPG key ID: 583A612D890159BE
4 changed files with 14 additions and 8 deletions

View file

@ -3,7 +3,7 @@ import got, { CancelableRequest, NormalizedOptions, Options as GotOptions, Reque
import { HttpProxyAgent, HttpsProxyAgent } from 'hpagent'
import { join } from 'path'
import { CONFIG } from '../initializers/config'
import { ACTIVITY_PUB, BINARY_CONTENT_TYPES, PEERTUBE_VERSION, REQUEST_TIMEOUT, WEBSERVER } from '../initializers/constants'
import { ACTIVITY_PUB, BINARY_CONTENT_TYPES, PEERTUBE_VERSION, REQUEST_TIMEOUTS, WEBSERVER } from '../initializers/constants'
import { pipelinePromise } from './core-utils'
import { processImage } from './image-utils'
import { logger, loggerTagsFactory } from './logger'
@ -20,6 +20,7 @@ export interface PeerTubeRequestError extends Error {
}
type PeerTubeRequestOptions = {
timeout?: number
activityPub?: boolean
bodyKBLimit?: number // 1MB
httpSignature?: {
@ -129,7 +130,7 @@ async function doRequestAndSaveToFile (
destPath: string,
options: PeerTubeRequestOptions = {}
) {
const gotOptions = buildGotOptions(options)
const gotOptions = buildGotOptions({ ...options, timeout: options.timeout ?? REQUEST_TIMEOUTS.FILE })
const outFile = createWriteStream(destPath)
@ -235,7 +236,7 @@ function buildGotOptions (options: PeerTubeRequestOptions) {
return {
method: options.method,
dnsCache: true,
timeout: REQUEST_TIMEOUT,
timeout: options.timeout ?? REQUEST_TIMEOUTS.DEFAULT,
json: options.json,
searchParams: options.searchParams,
retry: 2,