2022-09-18 03:27:08 +09:00
|
|
|
import { Inject, Injectable } from '@nestjs/common';
|
|
|
|
import { DI } from '@/di-symbols.js';
|
2022-09-21 05:33:11 +09:00
|
|
|
import type { Config } from '@/config.js';
|
2022-12-25 09:09:46 +09:00
|
|
|
import { bindThis } from '@/decorators.js';
|
2022-09-18 03:27:08 +09:00
|
|
|
import { TickChartsProcessorService } from './processors/TickChartsProcessorService.js';
|
|
|
|
import { ResyncChartsProcessorService } from './processors/ResyncChartsProcessorService.js';
|
|
|
|
import { CleanChartsProcessorService } from './processors/CleanChartsProcessorService.js';
|
|
|
|
import { CheckExpiredMutingsProcessorService } from './processors/CheckExpiredMutingsProcessorService.js';
|
|
|
|
import { CleanProcessorService } from './processors/CleanProcessorService.js';
|
2022-12-25 09:09:46 +09:00
|
|
|
import { AggregateRetentionProcessorService } from './processors/AggregateRetentionProcessorService.js';
|
2022-09-18 03:27:08 +09:00
|
|
|
import type Bull from 'bull';
|
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
export class SystemQueueProcessorsService {
|
|
|
|
constructor(
|
|
|
|
@Inject(DI.config)
|
|
|
|
private config: Config,
|
|
|
|
|
|
|
|
private tickChartsProcessorService: TickChartsProcessorService,
|
|
|
|
private resyncChartsProcessorService: ResyncChartsProcessorService,
|
|
|
|
private cleanChartsProcessorService: CleanChartsProcessorService,
|
2022-12-25 09:09:46 +09:00
|
|
|
private aggregateRetentionProcessorService: AggregateRetentionProcessorService,
|
2022-09-18 03:27:08 +09:00
|
|
|
private checkExpiredMutingsProcessorService: CheckExpiredMutingsProcessorService,
|
|
|
|
private cleanProcessorService: CleanProcessorService,
|
|
|
|
) {
|
|
|
|
}
|
|
|
|
|
2022-12-04 15:03:09 +09:00
|
|
|
@bindThis
|
2022-09-24 14:45:44 +09:00
|
|
|
public start(q: Bull.Queue): void {
|
|
|
|
q.process('tickCharts', (job, done) => this.tickChartsProcessorService.process(job, done));
|
|
|
|
q.process('resyncCharts', (job, done) => this.resyncChartsProcessorService.process(job, done));
|
|
|
|
q.process('cleanCharts', (job, done) => this.cleanChartsProcessorService.process(job, done));
|
2022-12-25 09:09:46 +09:00
|
|
|
q.process('aggregateRetention', (job, done) => this.aggregateRetentionProcessorService.process(job, done));
|
2022-09-24 14:45:44 +09:00
|
|
|
q.process('checkExpiredMutings', (job, done) => this.checkExpiredMutingsProcessorService.process(job, done));
|
|
|
|
q.process('clean', (job, done) => this.cleanProcessorService.process(job, done));
|
2022-09-18 03:27:08 +09:00
|
|
|
}
|
|
|
|
}
|