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