Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Delay video views scheduled job

Chocobozzz0223291c4580
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index 97fd1bdc14..0bb251043e 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -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
}
}