still trying

This commit is contained in:
Boki 2025-06-10 22:16:11 -04:00
parent 682b50d3b2
commit 716c90060a
4 changed files with 110 additions and 130 deletions

View file

@ -14,27 +14,38 @@ const getEvery24HourCron = (): string => {
};
export const proxyProvider: ProviderConfig = {
name: 'proxy-service',
service: 'proxy',
operations: { 'fetch-and-check': async (payload: { sources?: string[] }) => {
name: 'proxy-provider',
service: 'data-service',
operations: { 'fetch-and-check': async (payload: { sources?: string[] }) => {
const { proxyService } = await import('./proxy.tasks');
const { queueManager } = await import('../services/queue.service');
const { processProxies } = await import('../utils/batch-helpers');
const { processItems } = await import('../utils/batch-helpers');
const proxies = await proxyService.fetchProxiesFromSources();
if (proxies.length === 0) {
return { proxiesFetched: 0, jobsCreated: 0 };
} // Use simplified functional approach
const result = await processProxies(proxies, queueManager, {
totalDelayMs: parseInt(process.env.PROXY_VALIDATION_HOURS || '4') * 60 * 60 * 1000,
batchSize: parseInt(process.env.PROXY_BATCH_SIZE || '200'),
useBatching: process.env.PROXY_DIRECT_MODE !== 'true',
priority: 2,
service: 'proxy',
provider: 'proxy-service',
operation: 'check-proxy'
});return {
}
// Use generic function with routing parameters
const result = await processItems(
proxies,
(proxy, index) => ({
proxy,
index,
source: 'batch-processing'
}),
queueManager,
{
totalDelayMs: parseInt(process.env.PROXY_VALIDATION_HOURS || '4') * 60 * 60 * 1000,
batchSize: parseInt(process.env.PROXY_BATCH_SIZE || '200'),
useBatching: process.env.PROXY_DIRECT_MODE !== 'true',
priority: 2,
service: 'data-service',
provider: 'proxy-provider',
operation: 'check-proxy'
}
);return {
proxiesFetched: result.totalItems,
jobsCreated: result.jobsCreated,
mode: result.mode,