fixed data-service apperently
This commit is contained in:
parent
4b552e454c
commit
80c29283da
11 changed files with 106 additions and 92 deletions
|
|
@ -3,8 +3,8 @@
|
|||
*/
|
||||
import { ProxyInfo } from '@stock-bot/http';
|
||||
import { getLogger } from '@stock-bot/logger';
|
||||
import type { ProviderConfigWithSchedule } from '@stock-bot/queue';
|
||||
import { providerRegistry } from '@stock-bot/queue';
|
||||
import type { HandlerConfigWithSchedule } from '@stock-bot/queue';
|
||||
import { handlerRegistry } from '@stock-bot/queue';
|
||||
|
||||
const logger = getLogger('proxy-provider');
|
||||
|
||||
|
|
@ -12,7 +12,7 @@ const logger = getLogger('proxy-provider');
|
|||
export function initializeProxyProvider() {
|
||||
logger.info('Registering proxy provider with scheduled jobs...');
|
||||
|
||||
const proxyProviderConfig: ProviderConfigWithSchedule = {
|
||||
const proxyProviderConfig: HandlerConfigWithSchedule = {
|
||||
name: 'proxy',
|
||||
|
||||
operations: {
|
||||
|
|
@ -20,7 +20,7 @@ export function initializeProxyProvider() {
|
|||
// Fetch proxies from all configured sources
|
||||
logger.info('Processing fetch proxies from sources request');
|
||||
const { fetchProxiesFromSources } = await import('./proxy.tasks');
|
||||
const { processItems, queueManager } = await import('../index');
|
||||
const { processItems } = await import('@stock-bot/queue');
|
||||
|
||||
// Fetch all proxies from sources
|
||||
const proxies = await fetchProxiesFromSources();
|
||||
|
|
@ -32,8 +32,8 @@ export function initializeProxyProvider() {
|
|||
}
|
||||
|
||||
// Batch process the proxies through check-proxy operation
|
||||
const batchResult = await processItems(proxies, queueManager, {
|
||||
provider: 'proxy',
|
||||
const batchResult = await processItems(proxies, 'proxy', {
|
||||
handler: 'proxy',
|
||||
operation: 'check-proxy',
|
||||
totalDelayHours: 0.083, // 5 minutes (5/60 hours)
|
||||
batchSize: 50, // Process 50 proxies per batch
|
||||
|
|
@ -83,6 +83,6 @@ export function initializeProxyProvider() {
|
|||
],
|
||||
};
|
||||
|
||||
providerRegistry.registerWithSchedule(proxyProviderConfig);
|
||||
handlerRegistry.registerWithSchedule(proxyProviderConfig);
|
||||
logger.info('Proxy provider registered successfully with scheduled jobs');
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue