PeerTube/server/lib/schedulers/remove-old-jobs-scheduler.ts

24 lines
585 B
TypeScript
Raw Normal View History

import { isTestInstance } from '../../helpers/core-utils'
2018-02-27 11:08:59 +01:00
import { logger } from '../../helpers/logger'
import { JobQueue } from '../job-queue'
import { AbstractScheduler } from './abstract-scheduler'
export class RemoveOldJobsScheduler extends AbstractScheduler {
private static instance: AbstractScheduler
private constructor () {
super()
}
async execute () {
if (!isTestInstance()) logger.info('Removing old jobs (scheduler).')
2018-02-27 11:08:59 +01:00
JobQueue.Instance.removeOldJobs()
}
static get Instance () {
return this.instance || (this.instance = new this())
}
}