renaming services to more suitable names
This commit is contained in:
parent
3ae9de8376
commit
be6afef832
69 changed files with 41 additions and 2956 deletions
|
|
@ -0,0 +1,58 @@
|
|||
import { getLogger } from '@stock-bot/logger';
|
||||
import { handlerRegistry, type HandlerConfig, type ScheduledJobConfig } from '@stock-bot/queue';
|
||||
import { exchangeOperations } from './operations';
|
||||
|
||||
const logger = getLogger('exchanges-handler');
|
||||
|
||||
const HANDLER_NAME = 'exchanges';
|
||||
|
||||
const exchangesHandlerConfig: HandlerConfig = {
|
||||
concurrency: 1,
|
||||
maxAttempts: 3,
|
||||
scheduledJobs: [
|
||||
{
|
||||
operation: 'sync-all-exchanges',
|
||||
cronPattern: '0 0 * * 0', // Weekly on Sunday at midnight
|
||||
payload: { clearFirst: true },
|
||||
priority: 10,
|
||||
immediately: false,
|
||||
} as ScheduledJobConfig,
|
||||
{
|
||||
operation: 'sync-qm-exchanges',
|
||||
cronPattern: '0 1 * * *', // Daily at 1 AM
|
||||
payload: {},
|
||||
priority: 5,
|
||||
immediately: false,
|
||||
} as ScheduledJobConfig,
|
||||
{
|
||||
operation: 'sync-ib-exchanges',
|
||||
cronPattern: '0 3 * * *', // Daily at 3 AM
|
||||
payload: {},
|
||||
priority: 3,
|
||||
immediately: false,
|
||||
} as ScheduledJobConfig,
|
||||
{
|
||||
operation: 'sync-qm-provider-mappings',
|
||||
cronPattern: '0 3 * * *', // Daily at 3 AM
|
||||
payload: {},
|
||||
priority: 7,
|
||||
immediately: false,
|
||||
} as ScheduledJobConfig,
|
||||
],
|
||||
operations: {
|
||||
'sync-all-exchanges': exchangeOperations.syncAllExchanges,
|
||||
'sync-qm-exchanges': exchangeOperations.syncQMExchanges,
|
||||
'sync-ib-exchanges': exchangeOperations.syncIBExchanges,
|
||||
'sync-qm-provider-mappings': exchangeOperations.syncQMProviderMappings,
|
||||
'clear-postgresql-data': exchangeOperations.clearPostgreSQLData,
|
||||
'get-exchange-stats': exchangeOperations.getExchangeStats,
|
||||
'get-provider-mapping-stats': exchangeOperations.getProviderMappingStats,
|
||||
'enhanced-sync-status': exchangeOperations['enhanced-sync-status'],
|
||||
},
|
||||
};
|
||||
|
||||
export function initializeExchangesHandler(): void {
|
||||
logger.info('Registering exchanges handler...');
|
||||
handlerRegistry.registerHandler(HANDLER_NAME, exchangesHandlerConfig);
|
||||
logger.info('Exchanges handler registered successfully');
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue