52 lines
1.3 KiB
TypeScript
52 lines
1.3 KiB
TypeScript
import {
|
|
BaseHandler,
|
|
Disabled,
|
|
Handler,
|
|
Operation,
|
|
ScheduledOperation,
|
|
} from '@stock-bot/handlers';
|
|
import { getChannels, getPosts, getShorts, updateUniqueSymbols } from './actions';
|
|
|
|
@Handler('ceo')
|
|
@Disabled()
|
|
export class CeoHandler extends BaseHandler {
|
|
constructor(services: any) {
|
|
super(services); // Handler name read from @Handler decorator
|
|
}
|
|
|
|
@ScheduledOperation('get-channels', '0 */15 * * *', {
|
|
priority: 7,
|
|
immediately: false,
|
|
description: 'Get all CEO symbols and exchanges',
|
|
})
|
|
getChannels = getChannels;
|
|
|
|
@ScheduledOperation('update-unique-symbols-posts', '30 * * * *', {
|
|
immediately: false,
|
|
description: 'Process unique CEO symbols and schedule individual jobs',
|
|
payload: { action: 'get-posts' },
|
|
batch: {
|
|
size: 100,
|
|
delayInHours: 0.5,
|
|
},
|
|
})
|
|
updateUniqueSymbolsPosts = updateUniqueSymbols;
|
|
|
|
@ScheduledOperation('update-unique-symbols-shorts', '0 0 * * *', {
|
|
immediately: false,
|
|
description: 'Process unique CEO symbols and schedule individual jobs',
|
|
payload: { action: 'get-shorts' },
|
|
batch: {
|
|
size: 50,
|
|
delayInHours: 2,
|
|
direct: true, // Use direct mode for shorts
|
|
},
|
|
})
|
|
updateUniqueSymbolsShorts = updateUniqueSymbols;
|
|
|
|
@Operation('get-posts')
|
|
getPosts = getPosts;
|
|
|
|
@Operation('get-shorts')
|
|
getShorts = getShorts;
|
|
}
|