]>
Commit | Line | Data |
---|---|---|
1 | import { isTestInstance } from '../../helpers/core-utils' | |
2 | import { logger } from '../../helpers/logger' | |
3 | import { JobQueue } from '../job-queue' | |
4 | import { AbstractScheduler } from './abstract-scheduler' | |
5 | ||
6 | export class RemoveOldJobsScheduler extends AbstractScheduler { | |
7 | ||
8 | private static instance: AbstractScheduler | |
9 | ||
10 | private constructor () { | |
11 | super() | |
12 | } | |
13 | ||
14 | async execute () { | |
15 | if (!isTestInstance()) logger.info('Removing old jobs (scheduler).') | |
16 | ||
17 | JobQueue.Instance.removeOldJobs() | |
18 | } | |
19 | ||
20 | static get Instance () { | |
21 | return this.instance || (this.instance = new this()) | |
22 | } | |
23 | } |