diff --git a/apps/stock/data-ingestion/src/handlers/ceo/actions/process-individual-short.action.ts b/apps/stock/data-ingestion/src/handlers/ceo/actions/process-individual-short.action.ts index d5257c4..8e868e1 100644 --- a/apps/stock/data-ingestion/src/handlers/ceo/actions/process-individual-short.action.ts +++ b/apps/stock/data-ingestion/src/handlers/ceo/actions/process-individual-short.action.ts @@ -1,4 +1,3 @@ - import { getRandomUserAgent } from '@stock-bot/utils'; import type { CeoHandler } from '../ceo.handler'; @@ -40,7 +39,7 @@ export async function processIndividualSymbol( } this.logger.info( - `Successfully processed CEO symbol ${symbol} shorts and found ${shortCount} positions`, + `Successfully processed CEO symbol ${symbol} shorts and found ${shortCount} positions` ); return { ceoId, shortCount, timestamp }; diff --git a/apps/stock/data-ingestion/src/handlers/ceo/actions/process-individual-symbol.action.ts b/apps/stock/data-ingestion/src/handlers/ceo/actions/process-individual-symbol.action.ts index 8e44c17..5dc3f4f 100644 --- a/apps/stock/data-ingestion/src/handlers/ceo/actions/process-individual-symbol.action.ts +++ b/apps/stock/data-ingestion/src/handlers/ceo/actions/process-individual-symbol.action.ts @@ -39,7 +39,11 @@ export async function processIndividualSymbol( const spielCount = data.spiels.length; if (spielCount === 0) { this.logger.warn(`No spiels found for ceoId ${ceoId}`); - await this.mongodb.updateMany('ceoChannels', { ceoId }, { $set: { lastSpielTime: timestamp, finished: true } }); + await this.mongodb.updateMany( + 'ceoChannels', + { ceoId }, + { $set: { lastSpielTime: timestamp, finished: true } } + ); return null; // No data to process } const latestSpielTime = data.spiels[0]?.timestamp; @@ -77,7 +81,11 @@ export async function processIndividualSymbol( })); await this.mongodb.batchUpsert('ceoPosts', posts, ['spielId']); - await this.mongodb.updateMany('ceoChannels', { ceoId }, { $set: { lastSpielTime: latestSpielTime } }); + await this.mongodb.updateMany( + 'ceoChannels', + { ceoId }, + { $set: { lastSpielTime: latestSpielTime } } + ); this.logger.info(`Fetched ${spielCount} spiels for ceoId ${ceoId}`); await this.scheduleOperation( diff --git a/apps/stock/data-ingestion/src/handlers/index.ts b/apps/stock/data-ingestion/src/handlers/index.ts index acf9ca6..13d0fb5 100644 --- a/apps/stock/data-ingestion/src/handlers/index.ts +++ b/apps/stock/data-ingestion/src/handlers/index.ts @@ -32,7 +32,7 @@ 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; @@ -46,7 +46,7 @@ export async function initializeAllHandlers(serviceContainer: IServiceContainer) // 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'); @@ -58,7 +58,7 @@ export async function initializeAllHandlers(serviceContainer: IServiceContainer) } else { logger.warn('Handler scanner not found or missing registerHandlerClass method'); } - + // Also check the handler registry directly const handlerRegistry = diContainer.resolve('handlerRegistry'); if (handlerRegistry) { diff --git a/apps/stock/data-pipeline/src/handlers/exchanges/exchanges.handler.ts b/apps/stock/data-pipeline/src/handlers/exchanges/exchanges.handler.ts index 628a7be..a5690f4 100644 --- a/apps/stock/data-pipeline/src/handlers/exchanges/exchanges.handler.ts +++ b/apps/stock/data-pipeline/src/handlers/exchanges/exchanges.handler.ts @@ -1,9 +1,4 @@ -import { - BaseHandler, - Handler, - Operation, - ScheduledOperation, -} from '@stock-bot/handlers'; +import { BaseHandler, Handler, Operation, ScheduledOperation } from '@stock-bot/handlers'; import type { IServiceContainer } from '@stock-bot/types'; import { clearPostgreSQLData } from './operations/clear-postgresql-data.operations'; import { getSyncStatus } from './operations/enhanced-sync-status.operations'; diff --git a/apps/stock/data-pipeline/src/handlers/exchanges/operations/qm-exchanges.operations.ts b/apps/stock/data-pipeline/src/handlers/exchanges/operations/qm-exchanges.operations.ts index b0d077b..761fdb3 100644 --- a/apps/stock/data-pipeline/src/handlers/exchanges/operations/qm-exchanges.operations.ts +++ b/apps/stock/data-pipeline/src/handlers/exchanges/operations/qm-exchanges.operations.ts @@ -1,5 +1,5 @@ -import type { IServiceContainer } from '@stock-bot/types'; import { getLogger } from '@stock-bot/logger'; +import type { IServiceContainer } from '@stock-bot/types'; import type { JobPayload } from '../../../types/job-payloads'; const logger = getLogger('sync-qm-exchanges'); diff --git a/apps/stock/web-api/src/routes/exchange.routes.ts b/apps/stock/web-api/src/routes/exchange.routes.ts index d4b9af0..bf6357d 100644 --- a/apps/stock/web-api/src/routes/exchange.routes.ts +++ b/apps/stock/web-api/src/routes/exchange.routes.ts @@ -2,8 +2,8 @@ * Exchange management routes - Refactored */ import { Hono } from 'hono'; -import type { IServiceContainer } from '@stock-bot/types'; import { getLogger } from '@stock-bot/logger'; +import type { IServiceContainer } from '@stock-bot/types'; import { createExchangeService } from '../services/exchange.service'; import { createSuccessResponse, handleError } from '../utils/error-handler'; import { diff --git a/apps/stock/web-api/src/services/exchange.service.ts b/apps/stock/web-api/src/services/exchange.service.ts index 328cce4..528eed4 100644 --- a/apps/stock/web-api/src/services/exchange.service.ts +++ b/apps/stock/web-api/src/services/exchange.service.ts @@ -1,5 +1,5 @@ -import type { IServiceContainer } from '@stock-bot/types'; import { getLogger } from '@stock-bot/logger'; +import type { IServiceContainer } from '@stock-bot/types'; import { CreateExchangeRequest, CreateProviderMappingRequest, diff --git a/apps/stock/web-api/src/services/monitoring.service.ts b/apps/stock/web-api/src/services/monitoring.service.ts index 6bcda1e..e997e5f 100644 --- a/apps/stock/web-api/src/services/monitoring.service.ts +++ b/apps/stock/web-api/src/services/monitoring.service.ts @@ -818,12 +818,12 @@ export class MonitoringService { const workers = await bullQueue.getWorkers(); return workers.length; } - + // Fallback to getWorkersCount if available if (bullQueue.getWorkersCount && typeof bullQueue.getWorkersCount === 'function') { return await bullQueue.getWorkersCount(); } - + return 0; } catch (error) { this.logger.debug('Failed to get active worker count from BullMQ', { error }); diff --git a/libs/core/cache/src/redis-cache.ts b/libs/core/cache/src/redis-cache.ts index 50be98b..bbfb57a 100644 --- a/libs/core/cache/src/redis-cache.ts +++ b/libs/core/cache/src/redis-cache.ts @@ -305,18 +305,18 @@ export class RedisCache implements CacheProvider { return null; } this.updateStats(true); - + try { const parsed = JSON.parse(value); this.logger.debug('Cache raw get hit', { key }); return parsed; } catch (error) { // If JSON parsing fails, log the error with more context - this.logger.warn('Cache getRaw JSON parse failed', { - key, + this.logger.warn('Cache getRaw JSON parse failed', { + key, valueLength: value.length, valuePreview: value.substring(0, 100), - error: error instanceof Error ? error.message : String(error) + error: error instanceof Error ? error.message : String(error), }); // Return the raw value as-is if it can't be parsed return value as unknown as T; diff --git a/libs/core/config/src/cli.ts b/libs/core/config/src/cli.ts index d4fcae5..ed12f00 100644 --- a/libs/core/config/src/cli.ts +++ b/libs/core/config/src/cli.ts @@ -4,7 +4,6 @@ import { join } from 'path'; import { parseArgs } from 'util'; import { redactSecrets } from './utils/secrets'; import { - checkDeprecations, checkRequiredEnvVars, formatValidationResult, validateCompleteness, @@ -24,11 +23,6 @@ interface CliOptions { help?: boolean; } -const DEPRECATIONS = { - 'service.legacyMode': 'Use service.mode instead', - 'database.redis': 'Use database.dragonfly instead', -}; - const REQUIRED_PATHS = [ 'service.name', 'service.port', @@ -149,18 +143,6 @@ async function main() { console.log(formatValidationResult(pathResult)); console.log(); - // Deprecations - console.log('4. Deprecation Warnings:'); - const warnings = checkDeprecations(config, DEPRECATIONS); - if (warnings && warnings.length > 0) { - for (const warning of warnings) { - console.log(` ⚠️ ${warning.path}: ${warning.message}`); - } - } else { - console.log(' ✅ No deprecated options found'); - } - console.log(); - // Overall result const allValid = schemaResult.valid && envResult.valid && pathResult.valid; diff --git a/libs/core/config/src/utils/validation.ts b/libs/core/config/src/utils/validation.ts index ece59c7..ae36195 100644 --- a/libs/core/config/src/utils/validation.ts +++ b/libs/core/config/src/utils/validation.ts @@ -37,40 +37,6 @@ export function validateConfig(config: unknown, schema: z.ZodSchema): Vali } } -/** - * Check for deprecated configuration options - */ -export function checkDeprecations( - config: Record, - deprecations: Record -): ValidationResult['warnings'] { - const warnings: ValidationResult['warnings'] = []; - - function checkObject(obj: Record, path: string[] = []): void { - for (const [key, value] of Object.entries(obj)) { - const currentPath = [...path, key]; - const pathStr = currentPath.join('.'); - - if (pathStr in deprecations) { - const deprecationMessage = deprecations[pathStr]; - if (deprecationMessage) { - warnings?.push({ - path: pathStr, - message: deprecationMessage, - }); - } - } - - if (value && typeof value === 'object' && !Array.isArray(value)) { - checkObject(value as Record, currentPath); - } - } - } - - checkObject(config); - return warnings; -} - /** * Check for required environment variables */ diff --git a/libs/core/di/src/container/types.ts b/libs/core/di/src/container/types.ts index 5d273be..7f5bf33 100644 --- a/libs/core/di/src/container/types.ts +++ b/libs/core/di/src/container/types.ts @@ -6,7 +6,7 @@ import type { MongoDBClient } from '@stock-bot/mongodb'; import type { PostgreSQLClient } from '@stock-bot/postgres'; import type { ProxyManager } from '@stock-bot/proxy'; import type { QuestDBClient } from '@stock-bot/questdb'; -import type { SmartQueueManager } from '@stock-bot/queue'; +import type { QueueManager } from '@stock-bot/queue'; import type { IServiceContainer } from '@stock-bot/types'; import type { AppConfig } from '../config/schemas'; import type { HandlerScanner } from '../scanner'; @@ -25,7 +25,7 @@ export interface ServiceDefinitions { globalCache: CacheProvider | null; proxyManager: ProxyManager | null; browser: Browser; - queueManager: SmartQueueManager | null; + queueManager: QueueManager | null; // Database clients mongoClient: MongoDBClient | null; diff --git a/libs/core/di/src/registrations/service.registration.ts b/libs/core/di/src/registrations/service.registration.ts index 4a12673..87e4fe1 100644 --- a/libs/core/di/src/registrations/service.registration.ts +++ b/libs/core/di/src/registrations/service.registration.ts @@ -61,7 +61,7 @@ export function registerApplicationServices( if (config.queue?.enabled && config.redis.enabled) { container.register({ queueManager: asFunction(({ logger, handlerRegistry }) => { - const { SmartQueueManager } = require('@stock-bot/queue'); + const { QueueManager } = require('@stock-bot/queue'); const queueConfig = { serviceName: config.service?.serviceName || config.service?.name || 'unknown', redis: { @@ -79,7 +79,7 @@ export function registerApplicationServices( delayWorkerStart: config.queue!.delayWorkerStart ?? true, // Changed to true so ServiceApplication can start workers autoDiscoverHandlers: true, }; - return new SmartQueueManager(queueConfig, handlerRegistry, logger); + return new QueueManager(queueConfig, handlerRegistry, logger); }).singleton(), }); } else { diff --git a/libs/core/di/src/scanner/handler-scanner.ts b/libs/core/di/src/scanner/handler-scanner.ts index a15eb0f..696705a 100644 --- a/libs/core/di/src/scanner/handler-scanner.ts +++ b/libs/core/di/src/scanner/handler-scanner.ts @@ -3,7 +3,7 @@ * Discovers and registers handlers with the DI container */ -import { asClass, asFunction, type AwilixContainer } from 'awilix'; +import { asFunction, type AwilixContainer } from 'awilix'; import { glob } from 'glob'; import type { HandlerConfiguration, @@ -82,7 +82,7 @@ export class HandlerScanner { * Check if an exported value is a handler */ private isHandler(exported: any): boolean { - if (typeof exported !== 'function') return false; + if (typeof exported !== 'function') {return false;} // Check for handler metadata added by decorators const hasHandlerName = !!(exported as any).__handlerName; diff --git a/libs/core/di/src/service-application.ts b/libs/core/di/src/service-application.ts index 7657890..cd3c7f9 100644 --- a/libs/core/di/src/service-application.ts +++ b/libs/core/di/src/service-application.ts @@ -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'); 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, diff --git a/libs/core/handler-registry/src/registry.ts b/libs/core/handler-registry/src/registry.ts index 6f65b94..0eda661 100644 --- a/libs/core/handler-registry/src/registry.ts +++ b/libs/core/handler-registry/src/registry.ts @@ -7,9 +7,7 @@ import type { JobHandler, ScheduledJob } from '@stock-bot/types'; import type { HandlerConfiguration, HandlerMetadata, - OperationMetadata, RegistryStats, - ScheduleMetadata, } from './types'; export class HandlerRegistry { diff --git a/libs/core/handlers/src/base/BaseHandler.ts b/libs/core/handlers/src/base/BaseHandler.ts index 7c2127f..d38be9b 100644 --- a/libs/core/handlers/src/base/BaseHandler.ts +++ b/libs/core/handlers/src/base/BaseHandler.ts @@ -1,3 +1,4 @@ +import type { Collection } from 'mongodb'; import { createNamespacedCache } from '@stock-bot/cache'; import { getLogger } from '@stock-bot/logger'; import type { @@ -10,7 +11,6 @@ import type { ServiceTypes, } from '@stock-bot/types'; import { fetch } from '@stock-bot/utils'; -import type { Collection } from 'mongodb'; // Handler registry is now injected, not imported import { createJobHandler } from '../utils/create-job-handler'; @@ -60,7 +60,7 @@ export abstract class BaseHandler implements IHandler { const constructor = this.constructor as any; this.handlerName = constructor.__handlerName || handlerName || this.constructor.name.toLowerCase(); - + // Flatten all services onto the handler instance this.logger = getLogger(this.constructor.name); this.cache = services.cache; @@ -71,7 +71,7 @@ export abstract class BaseHandler implements IHandler { this.mongodb = services.mongodb; this.postgres = services.postgres; this.questdb = services.questdb; - + // Get the specific queue for this handler if (this.queueManager) { this.queue = this.queueManager.getQueue(this.handlerName); @@ -336,9 +336,9 @@ export abstract class BaseHandler implements IHandler { static extractMetadata(): HandlerMetadata | null { const constructor = this as any; const handlerName = constructor.__handlerName; - if (!handlerName){ + if (!handlerName) { return null; - } + } const operations = constructor.__operations || []; const schedules = constructor.__schedules || []; diff --git a/libs/core/queue/src/index.ts b/libs/core/queue/src/index.ts index 39e70df..aa77c2a 100644 --- a/libs/core/queue/src/index.ts +++ b/libs/core/queue/src/index.ts @@ -1,7 +1,6 @@ // Core exports export { Queue } from './queue'; export { QueueManager } from './queue-manager'; -export { SmartQueueManager } from './smart-queue-manager'; export { ServiceCache, createServiceCache } from './service-cache'; // Service utilities export { diff --git a/libs/core/queue/src/queue-manager.ts b/libs/core/queue/src/queue-manager.ts index 8b4a603..cfac11e 100644 --- a/libs/core/queue/src/queue-manager.ts +++ b/libs/core/queue/src/queue-manager.ts @@ -41,7 +41,7 @@ export class QueueManager { private shutdownPromise: Promise | null = null; private config: QueueManagerConfig; private readonly logger: Logger; - + // Service discovery features private serviceName?: string; private queueRoutes = new Map(); @@ -59,7 +59,7 @@ export class QueueManager { }, }; } - + this.config = config; this.serviceName = config.serviceName; this.handlerRegistry = handlerRegistry; @@ -80,7 +80,7 @@ export class QueueManager { if (config.serviceName && config.autoDiscoverHandlers !== false && handlerRegistry) { this.discoverQueueRoutes(); } - + this.logger.info('QueueManager initialized', { redis: `${config.redis.host}:${config.redis.port}`, service: this.serviceName, @@ -97,11 +97,11 @@ export class QueueManager { getQueue(queueName: string, options: QueueOptions = {}): Queue { let fullQueueName = queueName; let isOwnQueue = true; - + // Handle service namespacing if service name is configured if (this.serviceName) { const parsed = parseQueueName(queueName); - + if (parsed) { // Already in service:handler format fullQueueName = queueName; @@ -111,7 +111,7 @@ export class QueueManager { fullQueueName = getFullQueueName(this.serviceName, queueName); isOwnQueue = true; } - + // For cross-service queues, create without workers (producer-only) if (!isOwnQueue) { options = { @@ -122,10 +122,10 @@ export class QueueManager { // For own service queues, include handler registry options = { ...options, - handlerRegistry: this.handlerRegistry + handlerRegistry: this.handlerRegistry, }; } - + queueName = fullQueueName; } // Return existing queue if it exists @@ -487,9 +487,11 @@ export class QueueManager { let workersStarted = 0; const queues = this.queues; - - this.logger.info(`Starting workers for ${queues.size} queues: ${Array.from(queues.keys()).join(', ')} (service: ${this.serviceName})`); - + + this.logger.info( + `Starting workers for ${queues.size} queues: ${Array.from(queues.keys()).join(', ')} (service: ${this.serviceName})` + ); + for (const [queueName, queue] of queues) { // If we have a service name, check if this queue belongs to us if (this.serviceName) { @@ -504,7 +506,7 @@ export class QueueManager { continue; } } - + const workerCount = this.config.defaultQueueOptions?.workers || 1; const concurrency = this.config.defaultQueueOptions?.concurrency || 1; @@ -548,7 +550,7 @@ export class QueueManager { getConfig(): Readonly { return { ...this.config }; } - + /** * Send a job to any queue (local or remote) * This is the main method for cross-service communication @@ -564,7 +566,7 @@ export class QueueManager { const queue = this.getQueue(targetQueue); return queue.add(operation, { handler: targetQueue, operation, payload }, options); } - + // Resolve the target queue const route = this.resolveQueueRoute(targetQueue); if (!route) { @@ -582,7 +584,7 @@ export class QueueManager { // Use a producer queue for cross-service sending const producerQueue = this.getProducerQueue(route.fullName); - + const jobData: JobData = { handler: route.handler, operation, @@ -599,7 +601,7 @@ export class QueueManager { return producerQueue.add(operation, jobData, options); } - + /** * Resolve a queue name to a route */ @@ -640,7 +642,7 @@ export class QueueManager { return null; } - + /** * Get a producer queue for sending to other services */ @@ -654,7 +656,7 @@ export class QueueManager { } return this.producerQueues.get(queueName)!; } - + /** * Discover all available queue routes from handler registry */ diff --git a/libs/core/queue/src/queue.ts b/libs/core/queue/src/queue.ts index 4bebe06..985fa71 100644 --- a/libs/core/queue/src/queue.ts +++ b/libs/core/queue/src/queue.ts @@ -48,7 +48,7 @@ export class Queue { this.logger = logger || console; this.handlerRegistry = config.handlerRegistry; this.serviceName = config.serviceName; - + this.logger.debug('Queue constructor called', { queueName, serviceName: this.serviceName, @@ -180,7 +180,7 @@ export class Queue { ]); const isPaused = await this.bullQueue.isPaused(); - + // Get actual active worker count from BullMQ const activeWorkerCount = await this.getActiveWorkerCount(); @@ -317,7 +317,7 @@ export class Queue { // Add a name to identify the worker name: `${this.serviceName || 'unknown'}_worker_${i}`, }); - + this.logger.info(`Starting worker ${i + 1}/${workerCount} for queue`, { queueName: this.queueName, workerName: worker.name, @@ -380,14 +380,14 @@ export class Queue { if (!this.handlerRegistry) { throw new Error('Handler registry not configured for worker processing'); } - + this.logger.debug('Looking up handler in registry', { handler, operation, queueName: this.queueName, registeredHandlers: this.handlerRegistry.getHandlerNames(), }); - + const jobHandler = this.handlerRegistry.getOperation(handler, operation); if (!jobHandler) { @@ -424,7 +424,7 @@ export class Queue { this.logger.warn('Workers already started for queue', { queueName: this.queueName }); return; } - + this.logger.info('Starting workers manually', { queueName: this.queueName, workerCount, @@ -457,9 +457,9 @@ export class Queue { const workers = await this.bullQueue.getWorkers(); return workers; } catch (error) { - this.logger.error('Failed to get active workers', { - queueName: this.queueName, - error + this.logger.error('Failed to get active workers', { + queueName: this.queueName, + error, }); return []; } @@ -473,9 +473,9 @@ export class Queue { const workers = await this.bullQueue.getWorkers(); return workers.length; } catch (error) { - this.logger.error('Failed to get active worker count', { - queueName: this.queueName, - error + this.logger.error('Failed to get active worker count', { + queueName: this.queueName, + error, }); return 0; } @@ -484,14 +484,16 @@ export class Queue { /** * Get detailed worker information */ - async getWorkerDetails(): Promise> { + async getWorkerDetails(): Promise< + Array<{ + id: string; + name?: string; + addr?: string; + age?: number; + idle?: number; + started?: number; + }> + > { try { const workers = await this.bullQueue.getWorkers(); return workers.map(worker => ({ @@ -503,13 +505,11 @@ export class Queue { started: typeof worker.started === 'string' ? parseInt(worker.started) : worker.started, })); } catch (error) { - this.logger.error('Failed to get worker details', { - queueName: this.queueName, - error + this.logger.error('Failed to get worker details', { + queueName: this.queueName, + error, }); return []; } } - - } diff --git a/libs/core/queue/src/smart-queue-manager.ts b/libs/core/queue/src/smart-queue-manager.ts deleted file mode 100644 index e6404cc..0000000 --- a/libs/core/queue/src/smart-queue-manager.ts +++ /dev/null @@ -1,18 +0,0 @@ -// SmartQueueManager has been merged into QueueManager -// This file is kept for backward compatibility - -import { QueueManager } from './queue-manager'; -import type { SmartQueueConfig } from './types'; -import type { HandlerRegistry } from '@stock-bot/handler-registry'; -import type { Logger } from '@stock-bot/logger'; - -/** - * @deprecated Use QueueManager directly with serviceName config - * SmartQueueManager functionality has been merged into QueueManager - */ -export class SmartQueueManager extends QueueManager { - constructor(config: SmartQueueConfig, handlerRegistry?: HandlerRegistry, logger?: Logger) { - // SmartQueueConfig already has serviceName, just pass it to QueueManager - super(config, handlerRegistry, logger); - } -} \ No newline at end of file