diff --git a/.env b/.env index 942b1f9..cf5abf7 100644 --- a/.env +++ b/.env @@ -4,7 +4,7 @@ # Core Application Settings NODE_ENV=development -LOG_LEVEL=info +LOG_LEVEL=error # Data Service Configuration DATA_SERVICE_PORT=2001 diff --git a/apps/data-service/src/index.ts b/apps/data-service/src/index.ts index e093a55..7870bd9 100644 --- a/apps/data-service/src/index.ts +++ b/apps/data-service/src/index.ts @@ -13,6 +13,7 @@ import { ProxyManager } from '@stock-bot/utils'; import { exchangeRoutes, healthRoutes, queueRoutes } from './routes'; const config = initializeConfig(); +console.log('Data Service Configuration:', JSON.stringify(config, null, 2)); const serviceConfig = config.service; const databaseConfig = config.database; const queueConfig = config.queue; diff --git a/apps/data-service/src/providers/qm.provider.ts b/apps/data-service/src/providers/qm.provider.ts index 72d373e..5c93fd4 100644 --- a/apps/data-service/src/providers/qm.provider.ts +++ b/apps/data-service/src/providers/qm.provider.ts @@ -1,8 +1,8 @@ import { getLogger } from '@stock-bot/logger'; -import { - handlerRegistry, +import { createJobHandler, - type HandlerConfigWithSchedule + handlerRegistry, + type HandlerConfigWithSchedule } from '@stock-bot/queue'; import type { SymbolSpiderJob } from './qm.tasks'; @@ -62,16 +62,17 @@ export function initializeQMProvider() { { type: 'session-management', operation: 'create-sessions', - cronPattern: '*/15 * * * * *', // Every minute + cronPattern: '0 */15 * * *', // Every 15 minutes priority: 7, - immediately: true, + immediately: true, // Don't run on startup to avoid blocking description: 'Create and maintain QM sessions', }, { type: 'qm-maintnance', operation: 'spider-symbol-search', - cronPattern: '0 0 * * 0', // Every minute + cronPattern: '0 0 * * 0', // Every Sunday at midnight priority: 10, + immediately: true, // Don't run on startup description: 'Comprehensive symbol search using QM API', }, ], diff --git a/config/default.json b/config/default.json index 4a2d753..3f715ad 100644 --- a/config/default.json +++ b/config/default.json @@ -57,10 +57,9 @@ "retryDelay": 100 } }, - "logging": { + "log": { "level": "info", - "format": "json", - "prettyPrint": true + "format": "json" }, "providers": { "yahoo": { diff --git a/libs/queue/src/utils.ts b/libs/queue/src/utils.ts index d32739b..0c5e987 100644 --- a/libs/queue/src/utils.ts +++ b/libs/queue/src/utils.ts @@ -14,8 +14,8 @@ export function getRedisConnection(config: RedisConfig) { maxRetriesPerRequest: null, // Required by BullMQ enableReadyCheck: false, connectTimeout: isTest ? 1000 : 3000, - lazyConnect: true, - keepAlive: false, + lazyConnect: false, // Changed from true to ensure connection is established immediately + keepAlive: true, // Changed from false to maintain persistent connections retryStrategy: (times: number) => { const maxRetries = isTest ? 1 : 3; if (times > maxRetries) {