diff options
author | Chocobozzz <me@florianbigard.com> | 2020-11-10 14:55:18 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-11-10 15:04:08 +0100 |
commit | 0223291c45809d4a9dcc2be9ac4aa9406610a89c (patch) | |
tree | 9f377b58701944fe7ef2885196078cf06231c8cf /server/initializers/constants.ts | |
parent | 867ed6514db0ff67934304eac45c8dbf44e6eddc (diff) | |
download | PeerTube-0223291c45809d4a9dcc2be9ac4aa9406610a89c.tar.gz PeerTube-0223291c45809d4a9dcc2be9ac4aa9406610a89c.tar.zst PeerTube-0223291c45809d4a9dcc2be9ac4aa9406610a89c.zip |
Delay video views scheduled job
To not overload the federation
Diffstat (limited to 'server/initializers/constants.ts')
-rw-r--r-- | server/initializers/constants.ts | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index 97fd1bdc1..0bb251043 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts | |||
@@ -1,24 +1,24 @@ | |||
1 | import { CronRepeatOptions, EveryRepeatOptions } from 'bull' | ||
2 | import { randomBytes, randomInt } from 'crypto' | ||
3 | import { invert } from 'lodash' | ||
1 | import { join } from 'path' | 4 | import { join } from 'path' |
2 | import { randomBytes } from 'crypto' | ||
3 | import { ActivityPubActorType } from '../../shared/models/activitypub' | ||
4 | import { FollowState } from '../../shared/models/actors' | ||
5 | import { | 5 | import { |
6 | AbuseState, | 6 | AbuseState, |
7 | JobType, | ||
7 | VideoImportState, | 8 | VideoImportState, |
8 | VideoPrivacy, | 9 | VideoPrivacy, |
9 | VideoTranscodingFPS, | ||
10 | JobType, | ||
11 | VideoRateType, | 10 | VideoRateType, |
12 | VideoResolution, | 11 | VideoResolution, |
13 | VideoState | 12 | VideoState, |
13 | VideoTranscodingFPS | ||
14 | } from '../../shared/models' | 14 | } from '../../shared/models' |
15 | // Do not use barrels, remain constants as independent as possible | 15 | import { ActivityPubActorType } from '../../shared/models/activitypub' |
16 | import { isTestInstance, sanitizeHost, sanitizeUrl, root } from '../helpers/core-utils' | 16 | import { FollowState } from '../../shared/models/actors' |
17 | import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type' | 17 | import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type' |
18 | import { invert } from 'lodash' | ||
19 | import { CronRepeatOptions, EveryRepeatOptions } from 'bull' | ||
20 | import { VideoPlaylistPrivacy } from '../../shared/models/videos/playlist/video-playlist-privacy.model' | 18 | import { VideoPlaylistPrivacy } from '../../shared/models/videos/playlist/video-playlist-privacy.model' |
21 | import { VideoPlaylistType } from '../../shared/models/videos/playlist/video-playlist-type.model' | 19 | import { VideoPlaylistType } from '../../shared/models/videos/playlist/video-playlist-type.model' |
20 | // Do not use barrels, remain constants as independent as possible | ||
21 | import { isTestInstance, root, sanitizeHost, sanitizeUrl } from '../helpers/core-utils' | ||
22 | import { CONFIG, registerConfigChangedHandler } from './config' | 22 | import { CONFIG, registerConfigChangedHandler } from './config' |
23 | 23 | ||
24 | // --------------------------------------------------------------------------- | 24 | // --------------------------------------------------------------------------- |
@@ -172,7 +172,7 @@ const JOB_TTL: { [id in JobType]: number } = { | |||
172 | } | 172 | } |
173 | const REPEAT_JOBS: { [ id: string ]: EveryRepeatOptions | CronRepeatOptions } = { | 173 | const REPEAT_JOBS: { [ id: string ]: EveryRepeatOptions | CronRepeatOptions } = { |
174 | 'videos-views': { | 174 | 'videos-views': { |
175 | cron: '1 * * * *' // At 1 minute past the hour | 175 | cron: randomInt(1, 20) + ' * * * *' // Between 1-20 minutes past the hour |
176 | } | 176 | } |
177 | } | 177 | } |
178 | 178 | ||