]>
Commit | Line | Data |
---|---|---|
6fdc553a | 1 | import { isTestInstance } from '../../helpers/core-utils' |
ea99d15f | 2 | import { logger } from '../../helpers/logger' |
94a5ff8a C |
3 | import { JobQueue } from '../job-queue' |
4 | import { AbstractScheduler } from './abstract-scheduler' | |
74dc3bca | 5 | import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants' |
94a5ff8a C |
6 | |
7 | export class RemoveOldJobsScheduler extends AbstractScheduler { | |
8 | ||
9 | private static instance: AbstractScheduler | |
10 | ||
2baea0c7 C |
11 | protected schedulerIntervalMs = SCHEDULER_INTERVALS_MS.removeOldJobs |
12 | ||
94a5ff8a C |
13 | private constructor () { |
14 | super() | |
15 | } | |
16 | ||
2f5c6b2f C |
17 | protected internalExecute () { |
18 | if (!isTestInstance()) logger.info('Removing old jobs in scheduler.') | |
ea99d15f | 19 | |
2f5c6b2f | 20 | return JobQueue.Instance.removeOldJobs() |
94a5ff8a C |
21 | } |
22 | ||
23 | static get Instance () { | |
24 | return this.instance || (this.instance = new this()) | |
25 | } | |
26 | } |