huge refactor done
This commit is contained in:
parent
843a7b9b9b
commit
60d7de1da8
16 changed files with 472 additions and 443 deletions
|
|
@ -22,7 +22,7 @@ export class CeoHandler extends BaseHandler {
|
|||
updateCeoChannels = updateCeoChannels;
|
||||
|
||||
@Operation('update-unique-symbols')
|
||||
@ScheduledOperation('process-unique-symbols', '0 0 1 * *', {
|
||||
@ScheduledOperation('update-unique-symbols', '0 0 1 * *', {
|
||||
priority: 5,
|
||||
immediately: false,
|
||||
description: 'Process unique CEO symbols and schedule individual jobs',
|
||||
|
|
|
|||
|
|
@ -32,14 +32,43 @@ export async function initializeAllHandlers(serviceContainer: IServiceContainer)
|
|||
count: handlers.length,
|
||||
handlers: handlers.map(h => (h as any).__handlerName || h.name),
|
||||
});
|
||||
|
||||
// Log what metadata the handlers have
|
||||
for (const HandlerClass of handlers) {
|
||||
const metadata = (HandlerClass as any).__handlerMetadata;
|
||||
logger.info(`Handler ${HandlerClass.name} metadata`, {
|
||||
hasMetadata: !!metadata,
|
||||
handlerName: metadata?.name,
|
||||
operationCount: metadata?.operations?.length || 0,
|
||||
scheduledJobCount: metadata?.scheduledJobs?.length || 0,
|
||||
});
|
||||
}
|
||||
|
||||
// If the container has a handler scanner, we can manually register these
|
||||
const scanner = (serviceContainer as any).handlerScanner;
|
||||
if (scanner?.registerHandlerClass) {
|
||||
for (const HandlerClass of handlers) {
|
||||
scanner.registerHandlerClass(HandlerClass, { serviceName: 'data-ingestion' });
|
||||
// Get the DI container from the service container
|
||||
const diContainer = (serviceContainer as any)._diContainer;
|
||||
|
||||
if (diContainer?.resolve) {
|
||||
// Get handler scanner from DI container
|
||||
const scanner = diContainer.resolve('handlerScanner');
|
||||
if (scanner?.registerHandlerClass) {
|
||||
for (const HandlerClass of handlers) {
|
||||
scanner.registerHandlerClass(HandlerClass, { serviceName: 'data-ingestion' });
|
||||
}
|
||||
logger.info('Handlers registered with scanner');
|
||||
} else {
|
||||
logger.warn('Handler scanner not found or missing registerHandlerClass method');
|
||||
}
|
||||
logger.info('Handlers registered with scanner');
|
||||
|
||||
// Also check the handler registry directly
|
||||
const handlerRegistry = diContainer.resolve('handlerRegistry');
|
||||
if (handlerRegistry) {
|
||||
logger.info('Handler registry state after registration', {
|
||||
registeredHandlers: handlerRegistry.getHandlerNames(),
|
||||
handlersWithSchedule: handlerRegistry.getAllHandlersWithSchedule().size,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
logger.error('Could not access DI container from service container');
|
||||
}
|
||||
} catch (error) {
|
||||
logger.error('Handler initialization failed', { error });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue