commit 2 refactor

This commit is contained in:
Boki 2026-10-20 14:35:45 -04:00
parent 588f666943
commit 32e43c9243
310 changed files with 33318 additions and 31189 deletions

View file

@ -2,6 +2,7 @@
* Centralized Proxy Manager - Handles proxy storage, retrieval, and caching
*/
import type { CacheProvider } from '@stock-bot/cache';
import type { LoggerLike } from '@stock-bot/logger';
import type { ProxyInfo, ProxyManagerConfig, ProxyStats } from './types';
export class ProxyManager {
@ -11,10 +12,10 @@ export class ProxyManager {
private lastUpdate: Date | null = null;
private lastFetchTime: Date | null = null;
private isInitialized = false;
private logger: any;
private logger: LoggerLike;
private config: ProxyManagerConfig;
constructor(cache: CacheProvider, config: ProxyManagerConfig = {}, logger?: any) {
constructor(cache: CacheProvider, config: ProxyManagerConfig = {}, logger?: LoggerLike) {
this.cache = cache;
this.config = config;
this.logger = logger || console;
@ -85,7 +86,7 @@ export class ProxyManager {
// Note: We don't increment the index here since getProxy() already does that
const currentIndex = this.proxyIndex > 0 ? this.proxyIndex - 1 : this.proxies.length - 1;
const proxyInfo = this.proxies[currentIndex];
return proxyInfo || null;
}