17 lines
566 B
TypeScript
17 lines
566 B
TypeScript
|
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);
|
||
|
}
|
||
|
}
|