switched proxy and batch to new redis

This commit is contained in:
Boki 2025-06-10 13:52:06 -04:00
parent e98b1d8ae2
commit a86367bec5
3 changed files with 29 additions and 521 deletions

View file

@ -1,5 +1,5 @@
import { getLogger } from '@stock-bot/logger';
import createCache, { type CacheProvider } from '@stock-bot/cache';
import { createCache, type CacheProvider } from '@stock-bot/cache';
import { HttpClient, ProxyInfo } from '@stock-bot/http';
import pLimit from 'p-limit';
@ -110,8 +110,7 @@ async function resetProxyStats(): Promise<void> {
async function initializeSharedResources() {
if (!logger) {
logger = getLogger('proxy-tasks');
cache = createCache('hybrid', {
name: 'proxy-tasks',
cache = createCache({
keyPrefix: 'proxy:',
ttl: PROXY_CONFIG.CACHE_TTL,
enableMetrics: true

View file

@ -27,10 +27,8 @@ export class BatchProcessor {
private queueManager: any,
private cacheOptions?: { keyPrefix?: string; ttl?: number } // Optional cache configuration
) {
this.keyPrefix = cacheOptions?.keyPrefix || 'batch:';
// Initialize cache provider with batch-specific settings
this.cacheProvider = createCache('redis', {
name: 'batch-processor',
this.keyPrefix = cacheOptions?.keyPrefix || 'batch:'; // Initialize cache provider with batch-specific settings
this.cacheProvider = createCache({
keyPrefix: this.keyPrefix,
ttl: cacheOptions?.ttl || 86400 * 2, // 48 hours default
enableMetrics: true