fennec-be/src/pipeline-tasks/pipeline-task.consumer.ts

17 lines
566 B
TypeScript
Raw Normal View History

2021-03-02 16:28:37 +08:00
import { OnQueueCompleted, Process, Processor } from '@nestjs/bull';
import { Job } from 'bull';
import { PipelineTask } from './pipeline-task.entity';
import { PIPELINE_TASK_QUEUE } from './pipeline-tasks.constants';
import { PipelineTasksService } from './pipeline-tasks.service';
@Processor(PIPELINE_TASK_QUEUE)
export class PipelineTaskConsumer {
constructor(private readonly service: PipelineTasksService) {}
@Process()
async doTask() {}
@OnQueueCompleted()
onCompleted(job: Job<PipelineTask>) {
this.service.doNextTask(job.data.pipeline);
}
}