standartized OperationTracker. need to test it all out now

This commit is contained in:
Boki 2025-07-01 11:15:33 -04:00
parent f78558224f
commit 680b5fd2ae
21 changed files with 2112 additions and 752 deletions

View file

@ -6,6 +6,8 @@ import {
ScheduledOperation,
} from '@stock-bot/handlers';
import type { DataIngestionServices } from '../../types';
import type { OperationRegistry } from '../../shared/operation-manager';
import { createQMOperationRegistry } from './shared/operation-provider';
import {
checkSessions,
createSession,
@ -27,16 +29,22 @@ import {
updatePrices,
updateSymbolInfo
} from './actions';
import { initializeQMOperations } from './shared/operation-registry';
@Handler('qm')
export class QMHandler extends BaseHandler<DataIngestionServices> {
public operationRegistry: OperationRegistry;
constructor(services: any) {
super(services); // Handler name read from @Handler decorator
// Initialize operations after super() so services are available
initializeQMOperations(this.mongodb, this.logger).catch(error => {
this.logger.error('Failed to initialize QM operations', { error });
});
// Initialize operation registry with QM provider
createQMOperationRegistry(this.mongodb, this.logger)
.then(registry => {
this.operationRegistry = registry;
})
.catch(error => {
this.logger.error('Failed to initialize QM operations', { error });
});
}
/**
@ -168,4 +176,4 @@ export class QMHandler extends BaseHandler<DataIngestionServices> {
description: 'Check for symbols needing intraday updates every 30 minutes'
})
scheduleIntradayUpdates = scheduleIntradayUpdates;
}
}