feat-pipelines #1
@ -9,5 +9,10 @@ db:
|
||||
database: fennec
|
||||
username: fennec
|
||||
password:
|
||||
redis:
|
||||
host: 192.168.31.194
|
||||
port: 6379
|
||||
password:
|
||||
prefix: fennec
|
||||
workspaces:
|
||||
root: '/Users/ivanli/Projects/fennec/workspaces'
|
@ -10,6 +10,7 @@ import { ReposModule } from './repos/repos.module';
|
||||
import { PipelinesModule } from './pipelines/pipelines.module';
|
||||
import { PipelineTasksModule } from './pipeline-tasks/pipeline-tasks.module';
|
||||
import configuration from './commons/config/configuration';
|
||||
import { RedisModule } from 'nestjs-redis';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
@ -43,6 +44,16 @@ import configuration from './commons/config/configuration';
|
||||
ReposModule,
|
||||
PipelinesModule,
|
||||
PipelineTasksModule,
|
||||
RedisModule.forRootAsync({
|
||||
imports: [ConfigModule],
|
||||
useFactory: (configService: ConfigService) => ({
|
||||
host: configService.get<string>('db.redis.host', 'localhost'),
|
||||
port: configService.get<number>('db.redis.port', 6379),
|
||||
password: configService.get<string>('db.redis.password', ''),
|
||||
keyPrefix: configService.get<string>('db.redis.prefix', 'fennec'),
|
||||
}),
|
||||
inject: [ConfigService],
|
||||
}),
|
||||
],
|
||||
controllers: [AppController],
|
||||
providers: [AppService, AppResolver],
|
||||
|
@ -5,9 +5,25 @@ import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { PipelineTask } from './pipeline-task.entity';
|
||||
import { Pipeline } from '../pipelines/pipeline.entity';
|
||||
import { ReposModule } from '../repos/repos.module';
|
||||
import { RedisModule } from 'nestjs-redis';
|
||||
import { BullModule } from '@nestjs/bull';
|
||||
import {
|
||||
PIPELINE_TASK_QUEUE,
|
||||
PIPELINE_TASK_LOG_QUEUE,
|
||||
} from './pipeline-tasks.constants';
|
||||
|
||||
@Module({
|
||||
imports: [TypeOrmModule.forFeature([PipelineTask, Pipeline]), ReposModule],
|
||||
imports: [
|
||||
TypeOrmModule.forFeature([PipelineTask, Pipeline]),
|
||||
BullModule.registerQueue(
|
||||
{
|
||||
name: PIPELINE_TASK_QUEUE,
|
||||
},
|
||||
{ name: PIPELINE_TASK_LOG_QUEUE },
|
||||
),
|
||||
RedisModule,
|
||||
ReposModule,
|
||||
],
|
||||
providers: [PipelineTasksService, PipelineTasksResolver],
|
||||
})
|
||||
export class PipelineTasksModule {}
|
||||
|
@ -17,9 +17,9 @@ export class PipelineTasksService {
|
||||
private readonly repository: Repository<PipelineTask>,
|
||||
@InjectRepository(Pipeline)
|
||||
private readonly pipelineRepository: Repository<Pipeline>,
|
||||
private readonly redis: RedisService,
|
||||
@InjectQueue(PIPELINE_TASK_QUEUE)
|
||||
private readonly queue: Queue<PipelineTask>,
|
||||
private readonly redis: RedisService,
|
||||
) {}
|
||||
async addTask(dto: CreatePipelineTaskInput) {
|
||||
const pipeline = await this.pipelineRepository.findOneOrFail({
|
||||
|
Loading…
Reference in New Issue
Block a user