fixed up more type issues

This commit is contained in:
Boki 2025-06-20 09:51:32 -04:00
parent 3a10560de4
commit 87037e013f
9 changed files with 210 additions and 52 deletions

View file

@ -3,8 +3,7 @@
*/
import { ProxyInfo } from '@stock-bot/http';
import { getLogger } from '@stock-bot/logger';
import type { HandlerConfigWithSchedule } from '@stock-bot/queue';
import { handlerRegistry } from '@stock-bot/queue';
import { handlerRegistry, createJobHandler, type HandlerConfigWithSchedule } from '@stock-bot/queue';
const logger = getLogger('proxy-provider');
@ -16,7 +15,7 @@ export function initializeProxyProvider() {
name: 'proxy',
operations: {
'fetch-from-sources': async _payload => {
'fetch-from-sources': createJobHandler(async () => {
// Fetch proxies from all configured sources
logger.info('Processing fetch proxies from sources request');
const { fetchProxiesFromSources } = await import('./proxy.tasks');
@ -59,16 +58,16 @@ export function initializeProxyProvider() {
batchesCreated: batchResult.batchesCreated,
mode: batchResult.mode,
};
},
}),
'check-proxy': async (payload: ProxyInfo) => {
'check-proxy': createJobHandler(async (payload: ProxyInfo) => {
// payload is now the raw proxy info object
logger.debug('Processing proxy check request', {
proxy: `${payload.host}:${payload.port}`,
});
const { checkProxy } = await import('./proxy.tasks');
return checkProxy(payload);
},
}),
},
scheduledJobs: [
{