fix(gateway): add missing @Inject() decorators causing silent startup hang (#109)
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
Co-authored-by: Jason Woltje <jason@diversecanvas.com> Co-committed-by: Jason Woltje <jason@diversecanvas.com>
This commit was merged in pull request #109.
This commit is contained in:
@@ -8,7 +8,7 @@ export class ProviderService implements OnModuleInit {
|
|||||||
private readonly logger = new Logger(ProviderService.name);
|
private readonly logger = new Logger(ProviderService.name);
|
||||||
private registry!: ModelRegistry;
|
private registry!: ModelRegistry;
|
||||||
|
|
||||||
async onModuleInit(): Promise<void> {
|
onModuleInit(): void {
|
||||||
const authStorage = AuthStorage.inMemory();
|
const authStorage = AuthStorage.inMemory();
|
||||||
this.registry = new ModelRegistry(authStorage);
|
this.registry = new ModelRegistry(authStorage);
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
import { Injectable, Logger, type OnModuleInit, type OnModuleDestroy } from '@nestjs/common';
|
import {
|
||||||
|
Inject,
|
||||||
|
Injectable,
|
||||||
|
Logger,
|
||||||
|
type OnModuleInit,
|
||||||
|
type OnModuleDestroy,
|
||||||
|
} from '@nestjs/common';
|
||||||
import cron from 'node-cron';
|
import cron from 'node-cron';
|
||||||
import { SummarizationService } from './summarization.service.js';
|
import { SummarizationService } from './summarization.service.js';
|
||||||
|
|
||||||
@@ -7,7 +13,7 @@ export class CronService implements OnModuleInit, OnModuleDestroy {
|
|||||||
private readonly logger = new Logger(CronService.name);
|
private readonly logger = new Logger(CronService.name);
|
||||||
private readonly tasks: cron.ScheduledTask[] = [];
|
private readonly tasks: cron.ScheduledTask[] = [];
|
||||||
|
|
||||||
constructor(private readonly summarization: SummarizationService) {}
|
constructor(@Inject(SummarizationService) private readonly summarization: SummarizationService) {}
|
||||||
|
|
||||||
onModuleInit(): void {
|
onModuleInit(): void {
|
||||||
const summarizationSchedule = process.env['SUMMARIZATION_CRON'] ?? '0 */6 * * *'; // every 6 hours
|
const summarizationSchedule = process.env['SUMMARIZATION_CRON'] ?? '0 */6 * * *'; // every 6 hours
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export class SummarizationService {
|
|||||||
constructor(
|
constructor(
|
||||||
@Inject(LOG_SERVICE) private readonly logService: LogService,
|
@Inject(LOG_SERVICE) private readonly logService: LogService,
|
||||||
@Inject(MEMORY) private readonly memory: Memory,
|
@Inject(MEMORY) private readonly memory: Memory,
|
||||||
private readonly embeddings: EmbeddingService,
|
@Inject(EmbeddingService) private readonly embeddings: EmbeddingService,
|
||||||
@Inject(DB) private readonly db: Db,
|
@Inject(DB) private readonly db: Db,
|
||||||
) {
|
) {
|
||||||
this.apiKey = process.env['OPENAI_API_KEY'];
|
this.apiKey = process.env['OPENAI_API_KEY'];
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ import { AppModule } from './app.module.js';
|
|||||||
import { mountAuthHandler } from './auth/auth.controller.js';
|
import { mountAuthHandler } from './auth/auth.controller.js';
|
||||||
|
|
||||||
async function bootstrap(): Promise<void> {
|
async function bootstrap(): Promise<void> {
|
||||||
|
const logger = new Logger('Bootstrap');
|
||||||
|
|
||||||
if (!process.env['BETTER_AUTH_SECRET']) {
|
if (!process.env['BETTER_AUTH_SECRET']) {
|
||||||
throw new Error('BETTER_AUTH_SECRET is required');
|
throw new Error('BETTER_AUTH_SECRET is required');
|
||||||
}
|
}
|
||||||
@@ -28,7 +30,6 @@ async function bootstrap(): Promise<void> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const logger = new Logger('Bootstrap');
|
|
||||||
const app = await NestFactory.create<NestFastifyApplication>(
|
const app = await NestFactory.create<NestFastifyApplication>(
|
||||||
AppModule,
|
AppModule,
|
||||||
new FastifyAdapter({ bodyLimit: 1_048_576 }),
|
new FastifyAdapter({ bodyLimit: 1_048_576 }),
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import {
|
|||||||
Get,
|
Get,
|
||||||
HttpCode,
|
HttpCode,
|
||||||
HttpStatus,
|
HttpStatus,
|
||||||
|
Inject,
|
||||||
NotFoundException,
|
NotFoundException,
|
||||||
Param,
|
Param,
|
||||||
Patch,
|
Patch,
|
||||||
@@ -18,7 +19,7 @@ import type { CreateSkillDto, UpdateSkillDto } from './skills.dto.js';
|
|||||||
@Controller('api/skills')
|
@Controller('api/skills')
|
||||||
@UseGuards(AuthGuard)
|
@UseGuards(AuthGuard)
|
||||||
export class SkillsController {
|
export class SkillsController {
|
||||||
constructor(private readonly skills: SkillsService) {}
|
constructor(@Inject(SkillsService) private readonly skills: SkillsService) {}
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
async list() {
|
async list() {
|
||||||
|
|||||||
Reference in New Issue
Block a user