removing deprecations
This commit is contained in:
parent
fa67d666dc
commit
f6038d385f
21 changed files with 91 additions and 158 deletions
|
|
@ -3,16 +3,16 @@
|
|||
* Encapsulates common patterns for Hono-based microservices
|
||||
*/
|
||||
|
||||
import type { AwilixContainer } from 'awilix';
|
||||
import { Hono } from 'hono';
|
||||
import { cors } from 'hono/cors';
|
||||
import type { BaseAppConfig, UnifiedAppConfig } from '@stock-bot/config';
|
||||
import { toUnifiedConfig } from '@stock-bot/config';
|
||||
import type { HandlerRegistry } from '@stock-bot/handler-registry';
|
||||
import { getLogger, setLoggerConfig, shutdownLoggers, type Logger } from '@stock-bot/logger';
|
||||
import { Shutdown } from '@stock-bot/shutdown';
|
||||
import type { IServiceContainer } from '@stock-bot/types';
|
||||
import type { HandlerRegistry } from '@stock-bot/handler-registry';
|
||||
import type { ServiceDefinitions } from './container/types';
|
||||
import type { AwilixContainer } from 'awilix';
|
||||
|
||||
/**
|
||||
* Configuration for ServiceApplication
|
||||
|
|
@ -279,8 +279,8 @@ export class ServiceApplication {
|
|||
if (this.serviceConfig.enableHandlers && handlerInitializer) {
|
||||
this.logger.debug('Initializing handlers...');
|
||||
// Pass the service container with the DI container attached
|
||||
const containerWithDI = Object.assign({}, this.serviceContainer, {
|
||||
_diContainer: this.container
|
||||
const containerWithDI = Object.assign({}, this.serviceContainer, {
|
||||
_diContainer: this.container,
|
||||
});
|
||||
await handlerInitializer(containerWithDI);
|
||||
this.logger.info('Handlers initialized');
|
||||
|
|
@ -339,8 +339,10 @@ export class ServiceApplication {
|
|||
this.logger.debug('Creating scheduled jobs from registered handlers...');
|
||||
const handlerRegistry = this.container.resolve<HandlerRegistry>('handlerRegistry');
|
||||
const allHandlers = handlerRegistry.getAllHandlersWithSchedule();
|
||||
|
||||
this.logger.info(`Found ${allHandlers.size} handlers with scheduled jobs: ${Array.from(allHandlers.keys()).join(', ')}`);
|
||||
|
||||
this.logger.info(
|
||||
`Found ${allHandlers.size} handlers with scheduled jobs: ${Array.from(allHandlers.keys()).join(', ')}`
|
||||
);
|
||||
|
||||
let totalScheduledJobs = 0;
|
||||
for (const [handlerName, config] of allHandlers) {
|
||||
|
|
@ -368,9 +370,9 @@ export class ServiceApplication {
|
|||
hasHandlerRegistry: !!handlerRegistry,
|
||||
registeredHandlers: handlerRegistry.getHandlerNames(),
|
||||
});
|
||||
|
||||
|
||||
const queue = queueManager.getQueue(handlerName, {
|
||||
handlerRegistry: handlerRegistry
|
||||
handlerRegistry: handlerRegistry,
|
||||
});
|
||||
|
||||
for (const scheduledJob of config.scheduledJobs) {
|
||||
|
|
@ -395,7 +397,7 @@ export class ServiceApplication {
|
|||
operation: scheduledJob.operation,
|
||||
hasOperation: !!handlerRegistry.getOperation(handlerName, scheduledJob.operation),
|
||||
});
|
||||
|
||||
|
||||
await queue.addScheduledJob(
|
||||
scheduledJob.operation,
|
||||
jobData,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue