cba4c0464c
替代了先查询再订阅,确保数据不丢失。
15 lines
493 B
TypeScript
15 lines
493 B
TypeScript
import { ReposService } from './repos.service';
|
|
import { Processor, Process } from '@nestjs/bull';
|
|
import { Job } from 'bull';
|
|
import { ListLogsOption } from './models/list-logs.options';
|
|
import { LIST_LOGS_TASK } from './repos.constants';
|
|
@Processor(LIST_LOGS_TASK)
|
|
export class ListLogsConsumer {
|
|
constructor(private readonly service: ReposService) {}
|
|
@Process()
|
|
async listLogs(job: Job<ListLogsOption>) {
|
|
const logs = await this.service.listLogs(job.data);
|
|
return logs;
|
|
}
|
|
}
|