added logging
This commit is contained in:
parent
d76f0ff5ff
commit
5c87f068d6
10 changed files with 38 additions and 16 deletions
|
|
@ -77,8 +77,8 @@
|
||||||
"port": 6379,
|
"port": 6379,
|
||||||
"db": 1
|
"db": 1
|
||||||
},
|
},
|
||||||
"workers": 2,
|
"workers": 1,
|
||||||
"concurrency": 2,
|
"concurrency": 1,
|
||||||
"enableScheduledJobs": true,
|
"enableScheduledJobs": true,
|
||||||
"delayWorkerStart": false,
|
"delayWorkerStart": false,
|
||||||
"defaultJobOptions": {
|
"defaultJobOptions": {
|
||||||
|
|
@ -111,8 +111,13 @@
|
||||||
"timeout": 30000
|
"timeout": 30000
|
||||||
},
|
},
|
||||||
"proxy": {
|
"proxy": {
|
||||||
|
"enabled": true,
|
||||||
"cachePrefix": "proxy:",
|
"cachePrefix": "proxy:",
|
||||||
"ttl": 3600
|
"ttl": 3600,
|
||||||
|
"webshare": {
|
||||||
|
"apiKey": "y8ay534rcbybdkk3evnzmt640xxfhy7252ce2t98",
|
||||||
|
"apiUrl": "https://proxy.webshare.io/api/v2/"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"providers": {
|
"providers": {
|
||||||
"yahoo": {
|
"yahoo": {
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ export async function processIndividualSymbol(
|
||||||
await this.scheduleOperation('process-individual-symbol', {
|
await this.scheduleOperation('process-individual-symbol', {
|
||||||
ceoId: ceoId,
|
ceoId: ceoId,
|
||||||
timestamp: latestSpielTime,
|
timestamp: latestSpielTime,
|
||||||
}, {priority: 1});
|
}, {priority: 0});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.logger.info(
|
this.logger.info(
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ export async function updateUniqueSymbols(
|
||||||
await this.scheduleOperation('process-individual-symbol', {
|
await this.scheduleOperation('process-individual-symbol', {
|
||||||
ceoId: symbol.ceoId,
|
ceoId: symbol.ceoId,
|
||||||
symbol: symbol.symbol,
|
symbol: symbol.symbol,
|
||||||
});
|
}, {priority: 10 });
|
||||||
scheduledJobs++;
|
scheduledJobs++;
|
||||||
|
|
||||||
// Add small delay to avoid overwhelming the queue
|
// Add small delay to avoid overwhelming the queue
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,9 @@ import { createRoutes } from './routes/create-routes';
|
||||||
// Initialize configuration with service-specific overrides
|
// Initialize configuration with service-specific overrides
|
||||||
const config = initializeStockConfig('dataIngestion');
|
const config = initializeStockConfig('dataIngestion');
|
||||||
|
|
||||||
|
// Log the full configuration
|
||||||
|
const logger = getLogger('data-ingestion');
|
||||||
|
logger.info('Service configuration:', config);
|
||||||
|
|
||||||
// Create service application
|
// Create service application
|
||||||
const app = new ServiceApplication(
|
const app = new ServiceApplication(
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,9 @@ import { setupServiceContainer } from './container-setup';
|
||||||
// Initialize configuration with service-specific overrides
|
// Initialize configuration with service-specific overrides
|
||||||
const config = initializeStockConfig('dataPipeline');
|
const config = initializeStockConfig('dataPipeline');
|
||||||
|
|
||||||
|
// Log the full configuration
|
||||||
|
const logger = getLogger('data-pipeline');
|
||||||
|
logger.info('Service configuration:', config);
|
||||||
|
|
||||||
// Create service application
|
// Create service application
|
||||||
const app = new ServiceApplication(
|
const app = new ServiceApplication(
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,9 @@ if (config.queue) {
|
||||||
config.queue.delayWorkerStart = true;
|
config.queue.delayWorkerStart = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Log the full configuration
|
||||||
|
const logger = getLogger('web-api');
|
||||||
|
logger.info('Service configuration:', config);
|
||||||
|
|
||||||
// Create service application
|
// Create service application
|
||||||
const app = new ServiceApplication(
|
const app = new ServiceApplication(
|
||||||
|
|
|
||||||
|
|
@ -213,7 +213,7 @@ services: # Dragonfly - Redis replacement for caching and events
|
||||||
- REDIS_HOST=dragonfly
|
- REDIS_HOST=dragonfly
|
||||||
- REDIS_PORT=6379
|
- REDIS_PORT=6379
|
||||||
- REDIS_PASSWORD=
|
- REDIS_PASSWORD=
|
||||||
- REDIS_DB=0
|
- REDIS_DB=1
|
||||||
- REDIS_URL=redis://dragonfly:6379
|
- REDIS_URL=redis://dragonfly:6379
|
||||||
depends_on:
|
depends_on:
|
||||||
- dragonfly
|
- dragonfly
|
||||||
|
|
|
||||||
|
|
@ -86,22 +86,30 @@ export function findServiceForHandler(handlerName: string): string | undefined {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get full queue name with service namespace
|
* Get full queue name - just the handler name since each service has its own Redis DB
|
||||||
*/
|
*/
|
||||||
export function getFullQueueName(serviceName: string, handlerName: string): string {
|
export function getFullQueueName(serviceName: string, handlerName: string): string {
|
||||||
return `${serviceName}_${handlerName}`;
|
// Just return the handler name since DB isolation provides namespace separation
|
||||||
|
return handlerName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse a full queue name into service and handler
|
* Parse a full queue name into service and handler
|
||||||
|
* Since queue names are just handler names now, we need to find the service from the handler
|
||||||
*/
|
*/
|
||||||
export function parseQueueName(fullQueueName: string): { service: string; handler: string } | null {
|
export function parseQueueName(fullQueueName: string): { service: string; handler: string } | null {
|
||||||
const parts = fullQueueName.split('_');
|
// Queue name is just the handler name now
|
||||||
if (parts.length !== 2 || !parts[0] || !parts[1]) {
|
const handlerName = fullQueueName;
|
||||||
|
|
||||||
|
// Find which service owns this handler
|
||||||
|
const serviceName = findServiceForHandler(handlerName);
|
||||||
|
|
||||||
|
if (!serviceName) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
service: parts[0],
|
service: serviceName,
|
||||||
handler: parts[1],
|
handler: handlerName,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -212,7 +212,7 @@ export class SmartQueueManager extends QueueManager {
|
||||||
* Resolve a queue name to a route
|
* Resolve a queue name to a route
|
||||||
*/
|
*/
|
||||||
private resolveQueueRoute(queueName: string): QueueRoute | null {
|
private resolveQueueRoute(queueName: string): QueueRoute | null {
|
||||||
// Check if it's a full name (service_handler)
|
// Check if it's a handler name (which is now the full queue name)
|
||||||
const parsed = parseQueueName(queueName);
|
const parsed = parseQueueName(queueName);
|
||||||
if (parsed) {
|
if (parsed) {
|
||||||
const config = getServiceConfig(parsed.service);
|
const config = getServiceConfig(parsed.service);
|
||||||
|
|
@ -253,7 +253,8 @@ export class SmartQueueManager extends QueueManager {
|
||||||
private getProducerQueue(route: QueueRoute): BullQueue {
|
private getProducerQueue(route: QueueRoute): BullQueue {
|
||||||
if (!this.producerQueues.has(route.fullName)) {
|
if (!this.producerQueues.has(route.fullName)) {
|
||||||
const connection = this.getConnection(route.db);
|
const connection = this.getConnection(route.db);
|
||||||
const queue = new BullQueue(route.fullName, {
|
// Match the queue name format used by workers: {queueName}
|
||||||
|
const queue = new BullQueue(`{${route.fullName}}`, {
|
||||||
connection,
|
connection,
|
||||||
defaultJobOptions: this.getConfig().defaultQueueOptions?.defaultJobOptions || {},
|
defaultJobOptions: this.getConfig().defaultQueueOptions?.defaultJobOptions || {},
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,7 @@ export interface SmartQueueConfig extends QueueManagerConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface QueueRoute {
|
export interface QueueRoute {
|
||||||
/** Full queue name (e.g., 'data-ingestion_ceo') */
|
/** Full queue name (now just the handler name, e.g., 'ceo') */
|
||||||
fullName: string;
|
fullName: string;
|
||||||
/** Service that owns this queue */
|
/** Service that owns this queue */
|
||||||
service: string;
|
service: string;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue