From dcd75f786c42b4cc2049b17d535b3de3b7702fbc Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 3 Mar 2021 10:10:55 +0100 Subject: [PATCH] Rename request timeout --- server/initializers/constants.ts | 4 ++-- server/lib/activitypub/crawl.ts | 4 ++-- .../job-queue/handlers/activitypub-http-broadcast.ts | 10 +++++----- .../lib/job-queue/handlers/activitypub-http-unicast.ts | 8 ++++---- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index efbc628e7..6aaef3aa2 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts @@ -197,7 +197,7 @@ const JOB_PRIORITY = { const BROADCAST_CONCURRENCY = 30 // How many requests in parallel we do in activitypub-http-broadcast job const AP_CLEANER_CONCURRENCY = 10 // How many requests in parallel we do in activitypub-cleaner job const CRAWL_REQUEST_CONCURRENCY = 1 // How many requests in parallel to fetch remote data (likes, shares...) -const JOB_REQUEST_TIMEOUT = 7000 // 7 seconds +const REQUEST_TIMEOUT = 7000 // 7 seconds const JOB_COMPLETED_LIFETIME = 60000 * 60 * 24 * 2 // 2 days const VIDEO_IMPORT_TIMEOUT = 1000 * 3600 // 1 hour @@ -869,7 +869,7 @@ export { ABUSE_STATES, VIDEO_CHANNELS, LRU_CACHE, - JOB_REQUEST_TIMEOUT, + REQUEST_TIMEOUT, USER_PASSWORD_RESET_LIFETIME, USER_PASSWORD_CREATE_LIFETIME, MEMOIZE_TTL, diff --git a/server/lib/activitypub/crawl.ts b/server/lib/activitypub/crawl.ts index eeafdf4ba..1ed105bbe 100644 --- a/server/lib/activitypub/crawl.ts +++ b/server/lib/activitypub/crawl.ts @@ -1,4 +1,4 @@ -import { ACTIVITY_PUB, JOB_REQUEST_TIMEOUT, WEBSERVER } from '../../initializers/constants' +import { ACTIVITY_PUB, REQUEST_TIMEOUT, WEBSERVER } from '../../initializers/constants' import { doRequest } from '../../helpers/requests' import { logger } from '../../helpers/logger' import * as Bluebird from 'bluebird' @@ -16,7 +16,7 @@ async function crawlCollectionPage (uri: string, handler: HandlerFunction uri, json: true, activityPub: true, - timeout: JOB_REQUEST_TIMEOUT + timeout: REQUEST_TIMEOUT } const startDate = new Date() diff --git a/server/lib/job-queue/handlers/activitypub-http-broadcast.ts b/server/lib/job-queue/handlers/activitypub-http-broadcast.ts index e4d3dbbff..7174786d6 100644 --- a/server/lib/job-queue/handlers/activitypub-http-broadcast.ts +++ b/server/lib/job-queue/handlers/activitypub-http-broadcast.ts @@ -1,11 +1,11 @@ -import * as Bull from 'bull' import * as Bluebird from 'bluebird' +import * as Bull from 'bull' +import { ActivitypubHttpBroadcastPayload } from '@shared/models' import { logger } from '../../../helpers/logger' import { doRequest } from '../../../helpers/requests' -import { buildGlobalHeaders, buildSignedRequestOptions, computeBody } from './utils/activitypub-http-utils' -import { BROADCAST_CONCURRENCY, JOB_REQUEST_TIMEOUT } from '../../../initializers/constants' +import { BROADCAST_CONCURRENCY, REQUEST_TIMEOUT } from '../../../initializers/constants' import { ActorFollowScoreCache } from '../../files-cache' -import { ActivitypubHttpBroadcastPayload } from '@shared/models' +import { buildGlobalHeaders, buildSignedRequestOptions, computeBody } from './utils/activitypub-http-utils' async function processActivityPubHttpBroadcast (job: Bull.Job) { logger.info('Processing ActivityPub broadcast in job %d.', job.id) @@ -20,7 +20,7 @@ async function processActivityPubHttpBroadcast (job: Bull.Job) { uri: '', json: body, httpSignature: httpSignatureOptions, - timeout: JOB_REQUEST_TIMEOUT, + timeout: REQUEST_TIMEOUT, headers: buildGlobalHeaders(body) } diff --git a/server/lib/job-queue/handlers/activitypub-http-unicast.ts b/server/lib/job-queue/handlers/activitypub-http-unicast.ts index b65eeb677..74989d62e 100644 --- a/server/lib/job-queue/handlers/activitypub-http-unicast.ts +++ b/server/lib/job-queue/handlers/activitypub-http-unicast.ts @@ -1,10 +1,10 @@ import * as Bull from 'bull' +import { ActivitypubHttpUnicastPayload } from '@shared/models' import { logger } from '../../../helpers/logger' import { doRequest } from '../../../helpers/requests' -import { buildGlobalHeaders, buildSignedRequestOptions, computeBody } from './utils/activitypub-http-utils' -import { JOB_REQUEST_TIMEOUT } from '../../../initializers/constants' +import { REQUEST_TIMEOUT } from '../../../initializers/constants' import { ActorFollowScoreCache } from '../../files-cache' -import { ActivitypubHttpUnicastPayload } from '@shared/models' +import { buildGlobalHeaders, buildSignedRequestOptions, computeBody } from './utils/activitypub-http-utils' async function processActivityPubHttpUnicast (job: Bull.Job) { logger.info('Processing ActivityPub unicast in job %d.', job.id) @@ -20,7 +20,7 @@ async function processActivityPubHttpUnicast (job: Bull.Job) { uri, json: body, httpSignature: httpSignatureOptions, - timeout: JOB_REQUEST_TIMEOUT, + timeout: REQUEST_TIMEOUT, headers: buildGlobalHeaders(body) }