diff --git a/lib/drift/client.ts b/lib/drift/client.ts index a90df9d..8554923 100644 --- a/lib/drift/client.ts +++ b/lib/drift/client.ts @@ -171,9 +171,6 @@ export class DriftService { // Subscribe to Drift account updates (this makes RPC calls) await this.driftClient.subscribe() console.log('✅ Drift client subscribed to account updates') - - // Intercept WebSocket errors for health monitoring - this.interceptWebSocketErrors() // Get user account this.user = this.driftClient.getUser() @@ -182,6 +179,12 @@ export class DriftService { this.isInitialized = true console.log('✅ Drift service initialized successfully') + // CRITICAL FIX (Nov 25, 2025): Intercept errors BEFORE starting monitor + // Without this, errors aren't recorded and auto-restart never triggers + console.log('🔧 Setting up error interception for health monitoring...') + this.interceptWebSocketErrors() + console.log('✅ Error interception active') + // Start health monitoring (error-based restart instead of blind timer) const monitor = getDriftHealthMonitor() monitor.start()