fixed browser, made payload optional
This commit is contained in:
parent
917f91715a
commit
cde67db271
9 changed files with 10 additions and 12 deletions
|
|
@ -13,7 +13,6 @@ import { ProxyManager } from '@stock-bot/utils';
|
|||
import { exchangeRoutes, healthRoutes, queueRoutes } from './routes';
|
||||
|
||||
const config = initializeConfig();
|
||||
console.log('Configuration loaded:', config);
|
||||
const serviceConfig = config.service;
|
||||
const databaseConfig = config.database;
|
||||
const queueConfig = config.queue;
|
||||
|
|
@ -252,7 +251,7 @@ shutdown.onShutdown(async () => {
|
|||
logger.info('Shutting down loggers...');
|
||||
await shutdownLoggers();
|
||||
// Don't log after shutdown
|
||||
} catch (error) {
|
||||
} catch {
|
||||
// Silently ignore logger shutdown errors
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ export function initializeExchangeSyncProvider() {
|
|||
{
|
||||
type: 'exchange-sync-daily',
|
||||
operation: 'sync-ib-exchanges',
|
||||
payload: {},
|
||||
cronPattern: '0 3 * * *', // Daily at 3 AM
|
||||
priority: 3,
|
||||
description: 'Daily sync of IB exchanges to master table',
|
||||
|
|
|
|||
|
|
@ -72,7 +72,6 @@ export function initializeIBProvider() {
|
|||
{
|
||||
type: 'ib-exchanges-and-symbols',
|
||||
operation: 'ib-exchanges-and-symbols',
|
||||
payload: {},
|
||||
cronPattern: '0 0 * * 0', // Every Sunday at midnight
|
||||
priority: 5,
|
||||
description: 'Fetch and update IB exchanges and symbols data',
|
||||
|
|
|
|||
|
|
@ -73,7 +73,6 @@ export function initializeProxyProvider() {
|
|||
{
|
||||
type: 'proxy-fetch-and-check',
|
||||
operation: 'fetch-from-sources',
|
||||
payload: {},
|
||||
cronPattern: '0 0 * * 0', // Every week at midnight on Sunday
|
||||
priority: 0,
|
||||
description: 'Fetch and validate proxy list from sources',
|
||||
|
|
|
|||
|
|
@ -62,7 +62,6 @@ export function initializeQMProvider() {
|
|||
{
|
||||
type: 'session-management',
|
||||
operation: 'create-sessions',
|
||||
payload: {},
|
||||
cronPattern: '*/15 * * * * *', // Every minute
|
||||
priority: 7,
|
||||
immediately: true,
|
||||
|
|
@ -71,7 +70,6 @@ export function initializeQMProvider() {
|
|||
{
|
||||
type: 'qm-maintnance',
|
||||
operation: 'spider-symbol-search',
|
||||
payload: {},
|
||||
cronPattern: '0 0 * * 0', // Every minute
|
||||
priority: 10,
|
||||
description: 'Comprehensive symbol search using QM API',
|
||||
|
|
|
|||
|
|
@ -63,7 +63,6 @@ export function initializeWebShareProvider() {
|
|||
{
|
||||
type: 'webshare-fetch',
|
||||
operation: 'fetch-proxies',
|
||||
payload: {},
|
||||
cronPattern: '0 */6 * * *', // Every 6 hours
|
||||
priority: 3,
|
||||
description: 'Fetch fresh proxies from WebShare API',
|
||||
|
|
|
|||
|
|
@ -171,10 +171,15 @@ class BrowserSingleton {
|
|||
|
||||
if (proxy) {
|
||||
const [protocol, rest] = proxy.split('://');
|
||||
if (!rest) {
|
||||
throw new Error('Invalid proxy format. Expected protocol://host:port or protocol://user:pass@host:port');
|
||||
}
|
||||
|
||||
const [auth, hostPort] = rest.includes('@') ? rest.split('@') : [null, rest];
|
||||
const [host, port] = hostPort.split(':');
|
||||
const finalHostPort = hostPort || rest;
|
||||
const [host, port] = finalHostPort.split(':');
|
||||
|
||||
contextOptions.proxy = {
|
||||
contextOptions['proxy'] = {
|
||||
server: `${protocol}://${host}:${port}`,
|
||||
username: auth?.split(':')[0] || '',
|
||||
password: auth?.split(':')[1] || '',
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ export function createJobHandler<TPayload = unknown, TResult = unknown>(
|
|||
export interface ScheduledJob<T = unknown> {
|
||||
type: string;
|
||||
operation: string;
|
||||
payload: T;
|
||||
payload?: T;
|
||||
cronPattern: string;
|
||||
priority?: number;
|
||||
description?: string;
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ async function testProxyBrowser() {
|
|||
console.error('❌ Proxy browser test failed:', { error });
|
||||
} finally {
|
||||
try {
|
||||
// await Browser.cleanup();
|
||||
await Browser.close();
|
||||
console.log('🧹 Browser cleanup completed');
|
||||
} catch (cleanupError) {
|
||||
console.error('Failed to cleanup browser:', { error: cleanupError });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue