Compare commits

..

No commits in common. "607a4f57dee1b2b985b09a290d51d1aebfeec5d8" and "07fc98bc86140ba1d251b955dbc3582c7bb8964f" have entirely different histories.

3 changed files with 3 additions and 31 deletions

View File

@ -1,11 +1,6 @@
import { PipelineTaskLogs } from './models/pipeline-task-logs.model'; import { PipelineTaskLogs } from './models/pipeline-task-logs.model';
import { ReposService } from './../repos/repos.service'; import { ReposService } from './../repos/repos.service';
import { import { OnQueueCompleted, Process, Processor } from '@nestjs/bull';
OnQueueCompleted,
OnQueueFailed,
Process,
Processor,
} from '@nestjs/bull';
import { Job } from 'bull'; import { Job } from 'bull';
import { spawn } from 'child_process'; import { spawn } from 'child_process';
import { PipelineTask } from './pipeline-task.entity'; import { PipelineTask } from './pipeline-task.entity';
@ -126,9 +121,4 @@ export class PipelineTaskConsumer {
onCompleted(job: Job<PipelineTask>) { onCompleted(job: Job<PipelineTask>) {
this.service.doNextTask(job.data.pipeline); this.service.doNextTask(job.data.pipeline);
} }
@OnQueueFailed()
onFailed(job: Job<PipelineTask>) {
this.service.doNextTask(job.data.pipeline);
}
} }

View File

@ -1,7 +1,6 @@
import { Test, TestingModule } from '@nestjs/testing'; import { Test, TestingModule } from '@nestjs/testing';
import { PipelineTasksResolver } from './pipeline-tasks.resolver'; import { PipelineTasksResolver } from './pipeline-tasks.resolver';
import { PipelineTaskLogsService } from './pipeline-task-logs.service'; import { PipelineTaskLogsService } from './pipeline-task-logs.service';
import { PipelineTasksService } from './pipeline-tasks.service';
describe('PipelineTasksResolver', () => { describe('PipelineTasksResolver', () => {
let resolver: PipelineTasksResolver; let resolver: PipelineTasksResolver;
@ -10,10 +9,6 @@ describe('PipelineTasksResolver', () => {
const module: TestingModule = await Test.createTestingModule({ const module: TestingModule = await Test.createTestingModule({
providers: [ providers: [
PipelineTasksResolver, PipelineTasksResolver,
{
provide: PipelineTasksService,
useValue: {},
},
{ {
provide: PipelineTaskLogsService, provide: PipelineTaskLogsService,
useValue: {}, useValue: {},

View File

@ -1,7 +1,7 @@
import { ConflictException, Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { PipelineTask } from './pipeline-task.entity'; import { PipelineTask } from './pipeline-task.entity';
import { In, Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { CreatePipelineTaskInput } from './dtos/create-pipeline-task.input'; import { CreatePipelineTaskInput } from './dtos/create-pipeline-task.input';
import { RedisService } from 'nestjs-redis'; import { RedisService } from 'nestjs-redis';
import { Pipeline } from '../pipelines/pipeline.entity'; import { Pipeline } from '../pipelines/pipeline.entity';
@ -10,8 +10,6 @@ import { PIPELINE_TASK_QUEUE } from './pipeline-tasks.constants';
import { Queue } from 'bull'; import { Queue } from 'bull';
import { LockFailedException } from '../commons/exceptions/lock-failed.exception'; import { LockFailedException } from '../commons/exceptions/lock-failed.exception';
import { PubSub } from 'apollo-server-express'; import { PubSub } from 'apollo-server-express';
import { TaskStatuses } from './enums/task-statuses.enum';
import { isNil } from 'ramda';
@Injectable() @Injectable()
export class PipelineTasksService { export class PipelineTasksService {
@ -30,17 +28,6 @@ export class PipelineTasksService {
where: { id: dto.pipelineId }, where: { id: dto.pipelineId },
relations: ['project'], relations: ['project'],
}); });
// const hasUnfinishedTask = await this.repository
// .findOne({
// pipelineId: pipeline.id,
// status: In([TaskStatuses.pending, TaskStatuses.working]),
// })
// .then((val) => !isNil(val));
// if (hasUnfinishedTask) {
// throw new ConflictException(
// 'there are still unfinished task in the current pipeline.',
// );
// }
const task = await this.repository.save(this.repository.create(dto)); const task = await this.repository.save(this.repository.create(dto));
task.pipeline = pipeline; task.pipeline = pipeline;