1 import { isTestOrDevInstance } from '../../helpers/core-utils'
2 import { logger } from '../../helpers/logger'
3 import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants'
4 import { JobQueue } from '../job-queue'
5 import { AbstractScheduler } from './abstract-scheduler'
7 export class RemoveOldJobsScheduler extends AbstractScheduler {
9 private static instance: AbstractScheduler
11 protected schedulerIntervalMs = SCHEDULER_INTERVALS_MS.REMOVE_OLD_JOBS
13 private constructor () {
17 protected internalExecute () {
18 if (!isTestOrDevInstance()) logger.info('Removing old jobs in scheduler.')
20 return JobQueue.Instance.removeOldJobs()
23 static get Instance () {
24 return this.instance || (this.instance = new this())