]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/lib/schedulers/remove-old-jobs-scheduler.ts
Bumped to version v5.2.1
[github/Chocobozzz/PeerTube.git] / server / lib / schedulers / remove-old-jobs-scheduler.ts
CommitLineData
9452d4fd 1import { isTestOrDevInstance } from '../../helpers/core-utils'
ea99d15f 2import { logger } from '../../helpers/logger'
9452d4fd 3import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants'
94a5ff8a
C
4import { JobQueue } from '../job-queue'
5import { AbstractScheduler } from './abstract-scheduler'
6
c3b21b68
C
7// FIXME: delete this scheduler in a few versions (introduced in 5.0)
8// We introduced job removal directly using bullmq option but we still need to delete old jobs
94a5ff8a
C
9export class RemoveOldJobsScheduler extends AbstractScheduler {
10
11 private static instance: AbstractScheduler
12
61953742 13 protected schedulerIntervalMs = SCHEDULER_INTERVALS_MS.REMOVE_OLD_JOBS
2baea0c7 14
94a5ff8a
C
15 private constructor () {
16 super()
17 }
18
2f5c6b2f 19 protected internalExecute () {
9452d4fd 20 if (!isTestOrDevInstance()) logger.info('Removing old jobs in scheduler.')
ea99d15f 21
2f5c6b2f 22 return JobQueue.Instance.removeOldJobs()
94a5ff8a
C
23 }
24
25 static get Instance () {
26 return this.instance || (this.instance = new this())
27 }
28}