diff --git a/apps/stock/data-ingestion/src/handlers/qm/shared/session-manager.ts b/apps/stock/data-ingestion/src/handlers/qm/shared/session-manager.ts index acfca30..e9d9238 100644 --- a/apps/stock/data-ingestion/src/handlers/qm/shared/session-manager.ts +++ b/apps/stock/data-ingestion/src/handlers/qm/shared/session-manager.ts @@ -132,7 +132,7 @@ export class QMSessionManager { createdAt: session.createdAt instanceof Date ? session.createdAt.toISOString() : session.createdAt, id: session.uuid, sessionType, - } as any; + }; await this.cacheProvider.set(sessionKey, cachedSession, 86400); // 24 hour TTL @@ -261,8 +261,20 @@ export class QMSessionManager { /** * Get statistics about sessions */ - async getStats(): Promise> { - const stats: Record = {}; + async getStats(): Promise> { + const stats: Record = {}; for (const [sessionType, sessionId] of Object.entries(QM_SESSION_IDS)) { const sessions = await this.getSessions(sessionId); diff --git a/apps/stock/data-ingestion/src/handlers/qm/shared/types.ts b/apps/stock/data-ingestion/src/handlers/qm/shared/types.ts index 7848f39..d1ee6e6 100644 --- a/apps/stock/data-ingestion/src/handlers/qm/shared/types.ts +++ b/apps/stock/data-ingestion/src/handlers/qm/shared/types.ts @@ -3,7 +3,7 @@ */ export interface QMSession { - uuid?: string; // Unique identifier for the session + uuid: string; // Unique identifier for the session proxy: string; headers: HeadersInit; successfulCalls: number; @@ -46,7 +46,14 @@ export interface QMAuthResponse { error?: string; } -export interface CachedSession extends QMSession { +export interface CachedSession { + uuid: string; + proxy: string; + headers: HeadersInit; + successfulCalls: number; + failedCalls: number; + lastUsed: string; // ISO string for Redis storage + createdAt: string; // ISO string for Redis storage id: string; sessionType: string; }