fully cleaned things up, few more things to go.

This commit is contained in:
Boki 2025-06-14 15:42:47 -04:00
parent e5170b1c78
commit ad5e353ec3
11 changed files with 180 additions and 362 deletions

View file

@ -9,8 +9,8 @@ import { connectMongoDB, disconnectMongoDB } from '@stock-bot/mongodb-client';
import { Shutdown } from '@stock-bot/shutdown';
import { initializeIBResources } from './providers/ib.tasks';
import { initializeProxyResources } from './providers/proxy.tasks';
import { queueManager } from './services/queue-manager.service';
import { healthRoutes, marketDataRoutes, proxyRoutes, queueRoutes, testRoutes } from './routes';
import { initializeQueueManager, shutdownQueueManager } from './services/queue-manager.service';
import { healthRoutes, queueRoutes } from './routes';
// Load environment variables
loadEnvVariables();
@ -26,9 +26,6 @@ const shutdown = Shutdown.getInstance({ timeout: 15000 });
// Register all routes
app.route('', healthRoutes);
app.route('', queueRoutes);
app.route('', marketDataRoutes);
app.route('', proxyRoutes);
app.route('', testRoutes);
// Initialize services
async function initializeServices() {
@ -57,7 +54,7 @@ async function initializeServices() {
// Initialize queue manager (includes batch cache initialization)
logger.info('Starting queue manager initialization...');
await queueManager.initialize();
await initializeQueueManager();
logger.info('Queue manager initialized');
logger.info('All services initialized successfully');
@ -95,7 +92,7 @@ shutdown.onShutdown(async () => {
shutdown.onShutdown(async () => {
logger.info('Shutting down queue manager...');
try {
await queueManager.shutdown();
await shutdownQueueManager();
logger.info('Queue manager shut down successfully');
} catch (error) {
logger.error('Error shutting down queue manager', { error });