diff options
author | Chocobozzz <me@florianbigard.com> | 2021-03-03 10:10:55 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-03-03 10:10:55 +0100 |
commit | dcd75f786c42b4cc2049b17d535b3de3b7702fbc (patch) | |
tree | d2bb3339bf6e22b7585cd0a696c209c534d0cb2b | |
parent | 67bd004d843d29576f24c21437a33e1334ccb765 (diff) | |
download | PeerTube-dcd75f786c42b4cc2049b17d535b3de3b7702fbc.tar.gz PeerTube-dcd75f786c42b4cc2049b17d535b3de3b7702fbc.tar.zst PeerTube-dcd75f786c42b4cc2049b17d535b3de3b7702fbc.zip |
Rename request timeout
-rw-r--r-- | server/initializers/constants.ts | 4 | ||||
-rw-r--r-- | server/lib/activitypub/crawl.ts | 4 | ||||
-rw-r--r-- | server/lib/job-queue/handlers/activitypub-http-broadcast.ts | 10 | ||||
-rw-r--r-- | server/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 = { | |||
197 | const BROADCAST_CONCURRENCY = 30 // How many requests in parallel we do in activitypub-http-broadcast job | 197 | const BROADCAST_CONCURRENCY = 30 // How many requests in parallel we do in activitypub-http-broadcast job |
198 | const AP_CLEANER_CONCURRENCY = 10 // How many requests in parallel we do in activitypub-cleaner job | 198 | const AP_CLEANER_CONCURRENCY = 10 // How many requests in parallel we do in activitypub-cleaner job |
199 | const CRAWL_REQUEST_CONCURRENCY = 1 // How many requests in parallel to fetch remote data (likes, shares...) | 199 | const CRAWL_REQUEST_CONCURRENCY = 1 // How many requests in parallel to fetch remote data (likes, shares...) |
200 | const JOB_REQUEST_TIMEOUT = 7000 // 7 seconds | 200 | const REQUEST_TIMEOUT = 7000 // 7 seconds |
201 | const JOB_COMPLETED_LIFETIME = 60000 * 60 * 24 * 2 // 2 days | 201 | const JOB_COMPLETED_LIFETIME = 60000 * 60 * 24 * 2 // 2 days |
202 | const VIDEO_IMPORT_TIMEOUT = 1000 * 3600 // 1 hour | 202 | const VIDEO_IMPORT_TIMEOUT = 1000 * 3600 // 1 hour |
203 | 203 | ||
@@ -869,7 +869,7 @@ export { | |||
869 | ABUSE_STATES, | 869 | ABUSE_STATES, |
870 | VIDEO_CHANNELS, | 870 | VIDEO_CHANNELS, |
871 | LRU_CACHE, | 871 | LRU_CACHE, |
872 | JOB_REQUEST_TIMEOUT, | 872 | REQUEST_TIMEOUT, |
873 | USER_PASSWORD_RESET_LIFETIME, | 873 | USER_PASSWORD_RESET_LIFETIME, |
874 | USER_PASSWORD_CREATE_LIFETIME, | 874 | USER_PASSWORD_CREATE_LIFETIME, |
875 | MEMOIZE_TTL, | 875 | 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 @@ | |||
1 | import { ACTIVITY_PUB, JOB_REQUEST_TIMEOUT, WEBSERVER } from '../../initializers/constants' | 1 | import { ACTIVITY_PUB, REQUEST_TIMEOUT, WEBSERVER } from '../../initializers/constants' |
2 | import { doRequest } from '../../helpers/requests' | 2 | import { doRequest } from '../../helpers/requests' |
3 | import { logger } from '../../helpers/logger' | 3 | import { logger } from '../../helpers/logger' |
4 | import * as Bluebird from 'bluebird' | 4 | import * as Bluebird from 'bluebird' |
@@ -16,7 +16,7 @@ async function crawlCollectionPage <T> (uri: string, handler: HandlerFunction<T> | |||
16 | uri, | 16 | uri, |
17 | json: true, | 17 | json: true, |
18 | activityPub: true, | 18 | activityPub: true, |
19 | timeout: JOB_REQUEST_TIMEOUT | 19 | timeout: REQUEST_TIMEOUT |
20 | } | 20 | } |
21 | 21 | ||
22 | const startDate = new Date() | 22 | 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 @@ | |||
1 | import * as Bull from 'bull' | ||
2 | import * as Bluebird from 'bluebird' | 1 | import * as Bluebird from 'bluebird' |
2 | import * as Bull from 'bull' | ||
3 | import { ActivitypubHttpBroadcastPayload } from '@shared/models' | ||
3 | import { logger } from '../../../helpers/logger' | 4 | import { logger } from '../../../helpers/logger' |
4 | import { doRequest } from '../../../helpers/requests' | 5 | import { doRequest } from '../../../helpers/requests' |
5 | import { buildGlobalHeaders, buildSignedRequestOptions, computeBody } from './utils/activitypub-http-utils' | 6 | import { BROADCAST_CONCURRENCY, REQUEST_TIMEOUT } from '../../../initializers/constants' |
6 | import { BROADCAST_CONCURRENCY, JOB_REQUEST_TIMEOUT } from '../../../initializers/constants' | ||
7 | import { ActorFollowScoreCache } from '../../files-cache' | 7 | import { ActorFollowScoreCache } from '../../files-cache' |
8 | import { ActivitypubHttpBroadcastPayload } from '@shared/models' | 8 | import { buildGlobalHeaders, buildSignedRequestOptions, computeBody } from './utils/activitypub-http-utils' |
9 | 9 | ||
10 | async function processActivityPubHttpBroadcast (job: Bull.Job) { | 10 | async function processActivityPubHttpBroadcast (job: Bull.Job) { |
11 | logger.info('Processing ActivityPub broadcast in job %d.', job.id) | 11 | logger.info('Processing ActivityPub broadcast in job %d.', job.id) |
@@ -20,7 +20,7 @@ async function processActivityPubHttpBroadcast (job: Bull.Job) { | |||
20 | uri: '', | 20 | uri: '', |
21 | json: body, | 21 | json: body, |
22 | httpSignature: httpSignatureOptions, | 22 | httpSignature: httpSignatureOptions, |
23 | timeout: JOB_REQUEST_TIMEOUT, | 23 | timeout: REQUEST_TIMEOUT, |
24 | headers: buildGlobalHeaders(body) | 24 | headers: buildGlobalHeaders(body) |
25 | } | 25 | } |
26 | 26 | ||
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 @@ | |||
1 | import * as Bull from 'bull' | 1 | import * as Bull from 'bull' |
2 | import { ActivitypubHttpUnicastPayload } from '@shared/models' | ||
2 | import { logger } from '../../../helpers/logger' | 3 | import { logger } from '../../../helpers/logger' |
3 | import { doRequest } from '../../../helpers/requests' | 4 | import { doRequest } from '../../../helpers/requests' |
4 | import { buildGlobalHeaders, buildSignedRequestOptions, computeBody } from './utils/activitypub-http-utils' | 5 | import { REQUEST_TIMEOUT } from '../../../initializers/constants' |
5 | import { JOB_REQUEST_TIMEOUT } from '../../../initializers/constants' | ||
6 | import { ActorFollowScoreCache } from '../../files-cache' | 6 | import { ActorFollowScoreCache } from '../../files-cache' |
7 | import { ActivitypubHttpUnicastPayload } from '@shared/models' | 7 | import { buildGlobalHeaders, buildSignedRequestOptions, computeBody } from './utils/activitypub-http-utils' |
8 | 8 | ||
9 | async function processActivityPubHttpUnicast (job: Bull.Job) { | 9 | async function processActivityPubHttpUnicast (job: Bull.Job) { |
10 | logger.info('Processing ActivityPub unicast in job %d.', job.id) | 10 | logger.info('Processing ActivityPub unicast in job %d.', job.id) |
@@ -20,7 +20,7 @@ async function processActivityPubHttpUnicast (job: Bull.Job) { | |||
20 | uri, | 20 | uri, |
21 | json: body, | 21 | json: body, |
22 | httpSignature: httpSignatureOptions, | 22 | httpSignature: httpSignatureOptions, |
23 | timeout: JOB_REQUEST_TIMEOUT, | 23 | timeout: REQUEST_TIMEOUT, |
24 | headers: buildGlobalHeaders(body) | 24 | headers: buildGlobalHeaders(body) |
25 | } | 25 | } |
26 | 26 | ||