]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - server/lib/schedulers/remove-old-jobs-scheduler.ts
/!\ Use a dedicated config file for development
[github/Chocobozzz/PeerTube.git] / server / lib / schedulers / remove-old-jobs-scheduler.ts
... / ...
CommitLineData
1import { isTestOrDevInstance } from '../../helpers/core-utils'
2import { logger } from '../../helpers/logger'
3import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants'
4import { JobQueue } from '../job-queue'
5import { AbstractScheduler } from './abstract-scheduler'
6
7export class RemoveOldJobsScheduler extends AbstractScheduler {
8
9 private static instance: AbstractScheduler
10
11 protected schedulerIntervalMs = SCHEDULER_INTERVALS_MS.REMOVE_OLD_JOBS
12
13 private constructor () {
14 super()
15 }
16
17 protected internalExecute () {
18 if (!isTestOrDevInstance()) logger.info('Removing old jobs in scheduler.')
19
20 return JobQueue.Instance.removeOldJobs()
21 }
22
23 static get Instance () {
24 return this.instance || (this.instance = new this())
25 }
26}