1
0
Fork 0
peertube/server/lib/schedulers/remove-old-jobs-scheduler.ts

29 lines
924 B
TypeScript
Raw Normal View History

import { isTestOrDevInstance } from '../../helpers/core-utils'
2018-02-27 05:08:59 -05:00
import { logger } from '../../helpers/logger'
import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants'
import { JobQueue } from '../job-queue'
import { AbstractScheduler } from './abstract-scheduler'
// FIXME: delete this scheduler in a few versions (introduced in 5.0)
// We introduced job removal directly using bullmq option but we still need to delete old jobs
export class RemoveOldJobsScheduler extends AbstractScheduler {
private static instance: AbstractScheduler
2021-10-22 04:28:00 -04:00
protected schedulerIntervalMs = SCHEDULER_INTERVALS_MS.REMOVE_OLD_JOBS
private constructor () {
super()
}
protected internalExecute () {
if (!isTestOrDevInstance()) logger.info('Removing old jobs in scheduler.')
2018-02-27 05:08:59 -05:00
return JobQueue.Instance.removeOldJobs()
}
static get Instance () {
return this.instance || (this.instance = new this())
}
}