moved jobs to provider config
This commit is contained in:
parent
f9c2860ff4
commit
52c2f08db2
7 changed files with 183 additions and 76 deletions
|
|
@ -9,34 +9,25 @@ export const proxyProvider: ProviderConfig = {
|
|||
return await proxyService.fetchProxiesFromSources();
|
||||
},
|
||||
|
||||
// 'check-specific': async (payload: { proxies: any[] }) => {
|
||||
// const { proxyService } = await import('../services/proxy.service');
|
||||
// return await proxyService.checkProxies(payload.proxies);
|
||||
// },
|
||||
'check-specific': async (payload: { proxies: any[] }) => {
|
||||
const { proxyService } = await import('../services/proxy.service');
|
||||
return await proxyService.checkProxies(payload.proxies);
|
||||
},
|
||||
|
||||
// 'get-stats': async (payload: { includeDetails?: boolean }) => {
|
||||
// const { proxyService } = await import('../services/proxy.service');
|
||||
// return await proxyService.getProxyStats(payload.includeDetails);
|
||||
// },
|
||||
|
||||
// 'cleanup-old-data': async (payload: { daysToKeep?: number }) => {
|
||||
// const { proxyService } = await import('../services/proxy.service');
|
||||
// return await proxyService.cleanupOldData(payload.daysToKeep || 7);
|
||||
// },
|
||||
|
||||
// 'get-working-proxy': async (payload: { protocol?: string; country?: string; timeout?: number }) => {
|
||||
// const { proxyService } = await import('../services/proxy.service');
|
||||
// return await proxyService.getWorkingProxy(payload);
|
||||
// },
|
||||
|
||||
// 'validate-proxy': async (payload: { proxy: any; testUrl?: string }) => {
|
||||
// const { proxyService } = await import('../services/proxy.service');
|
||||
// return await proxyService.validateProxy(payload.proxy, payload.testUrl);
|
||||
// },
|
||||
|
||||
// 'rotate-proxies': async (payload: { count?: number }) => {
|
||||
// const { proxyService } = await import('../services/proxy.service');
|
||||
// return await proxyService.rotateProxies(payload.count || 5);
|
||||
// }
|
||||
}
|
||||
'get-working-proxy': async (payload: { protocol?: string; country?: string; timeout?: number }) => {
|
||||
const { proxyService } = await import('../services/proxy.service');
|
||||
return await proxyService.getWorkingProxy();
|
||||
}
|
||||
},
|
||||
|
||||
scheduledJobs: [
|
||||
{
|
||||
type: 'proxy-maintenance',
|
||||
operation: 'fetch-and-check',
|
||||
payload: {},
|
||||
cronPattern: '*/15 * * * *', // Every 15 minutes
|
||||
priority: 5,
|
||||
description: 'Fetch and validate proxy list from sources'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
|
|
|||
|
|
@ -155,8 +155,7 @@ export const quotemediaProvider: ProviderConfig = {
|
|||
}));
|
||||
|
||||
await new Promise(resolve => setTimeout(resolve, 400 + Math.random() * 300));
|
||||
|
||||
return {
|
||||
return {
|
||||
symbol: payload.symbol,
|
||||
expiration: payload.expiration || new Date(Date.now() + 30 * 24 * 60 * 60 * 1000).toISOString().split('T')[0],
|
||||
calls,
|
||||
|
|
@ -164,5 +163,32 @@ export const quotemediaProvider: ProviderConfig = {
|
|||
source: 'quotemedia'
|
||||
};
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
scheduledJobs: [
|
||||
{
|
||||
type: 'quotemedia-premium-refresh',
|
||||
operation: 'batch-quotes',
|
||||
payload: { symbols: ['AAPL', 'GOOGL', 'MSFT'] },
|
||||
cronPattern: '*/2 * * * *', // Every 2 minutes
|
||||
priority: 7,
|
||||
description: 'Refresh premium quotes with detailed market data'
|
||||
},
|
||||
{
|
||||
type: 'quotemedia-options-update',
|
||||
operation: 'options-chain',
|
||||
payload: { symbol: 'SPY' },
|
||||
cronPattern: '*/10 * * * *', // Every 10 minutes
|
||||
priority: 5,
|
||||
description: 'Update options chain data for SPY ETF'
|
||||
},
|
||||
{
|
||||
type: 'quotemedia-profiles',
|
||||
operation: 'company-profile',
|
||||
payload: { symbol: 'AAPL' },
|
||||
cronPattern: '0 9 * * 1-5', // Weekdays at 9 AM
|
||||
priority: 3,
|
||||
description: 'Update company profile data'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
|
|
|||
|
|
@ -222,8 +222,34 @@ export const yahooProvider: ProviderConfig = {
|
|||
};
|
||||
|
||||
await new Promise(resolve => setTimeout(resolve, 180 + Math.random() * 120));
|
||||
|
||||
return recommendations;
|
||||
return recommendations;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
scheduledJobs: [
|
||||
{
|
||||
type: 'yahoo-market-refresh',
|
||||
operation: 'live-data',
|
||||
payload: { symbol: 'AAPL' },
|
||||
cronPattern: '*/1 * * * *', // Every minute
|
||||
priority: 8,
|
||||
description: 'Refresh Apple stock price from Yahoo Finance'
|
||||
},
|
||||
{
|
||||
type: 'yahoo-sp500-update',
|
||||
operation: 'live-data',
|
||||
payload: { symbol: 'SPY' },
|
||||
cronPattern: '*/2 * * * *', // Every 2 minutes
|
||||
priority: 9,
|
||||
description: 'Update S&P 500 ETF price'
|
||||
},
|
||||
{
|
||||
type: 'yahoo-earnings-check',
|
||||
operation: 'earnings',
|
||||
payload: { symbol: 'AAPL' },
|
||||
cronPattern: '0 16 * * 1-5', // Weekdays at 4 PM (market close)
|
||||
priority: 6,
|
||||
description: 'Check earnings data for Apple'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue