Delay video views scheduled job

To not overload the federation
pull/3289/head
Chocobozzz 2020-11-10 14:55:18 +01:00
parent 867ed6514d
commit 0223291c45
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 11 additions and 11 deletions

View File

@ -1,24 +1,24 @@
import { CronRepeatOptions, EveryRepeatOptions } from 'bull'
import { randomBytes, randomInt } from 'crypto'
import { invert } from 'lodash'
import { join } from 'path'
import { randomBytes } from 'crypto'
import { ActivityPubActorType } from '../../shared/models/activitypub'
import { FollowState } from '../../shared/models/actors'
import {
AbuseState,
JobType,
VideoImportState,
VideoPrivacy,
VideoTranscodingFPS,
JobType,
VideoRateType,
VideoResolution,
VideoState
VideoState,
VideoTranscodingFPS
} from '../../shared/models'
// Do not use barrels, remain constants as independent as possible
import { isTestInstance, sanitizeHost, sanitizeUrl, root } from '../helpers/core-utils'
import { ActivityPubActorType } from '../../shared/models/activitypub'
import { FollowState } from '../../shared/models/actors'
import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type'
import { invert } from 'lodash'
import { CronRepeatOptions, EveryRepeatOptions } from 'bull'
import { VideoPlaylistPrivacy } from '../../shared/models/videos/playlist/video-playlist-privacy.model'
import { VideoPlaylistType } from '../../shared/models/videos/playlist/video-playlist-type.model'
// Do not use barrels, remain constants as independent as possible
import { isTestInstance, root, sanitizeHost, sanitizeUrl } from '../helpers/core-utils'
import { CONFIG, registerConfigChangedHandler } from './config'
// ---------------------------------------------------------------------------
@ -172,7 +172,7 @@ const JOB_TTL: { [id in JobType]: number } = {
}
const REPEAT_JOBS: { [ id: string ]: EveryRepeatOptions | CronRepeatOptions } = {
'videos-views': {
cron: '1 * * * *' // At 1 minute past the hour
cron: randomInt(1, 20) + ' * * * *' // Between 1-20 minutes past the hour
}
}