UNPKG

ai-debug-local-mcp

Version:

🎯 ENHANCED AI GUIDANCE v4.1.2: Dramatically improved tool descriptions help AI users choose the right tools instead of 'close enough' options. Ultra-fast keyboard automation (10x speed), universal recording, multi-ecosystem debugging support, and compreh

81 lines • 3.34 kB
/** * Phoenix/BEAM VM Optimized Circuit Breaker Configuration * * Addresses feedback about circuit breakers being too sensitive for Phoenix applications. * BEAM VM has natural fault tolerance through supervision trees, so circuit breakers * need different thresholds. */ export class PhoenixCircuitBreakerConfig { /** * Get Phoenix-optimized circuit breaker configuration */ static getPhoenixConfig() { return { failureThreshold: 5, // Higher - BEAM can handle more errors recoveryTimeoutMs: 30000, // 30s - allow supervision tree recovery halfOpenMaxAttempts: 3, // More retries in half-open state successThreshold: 2, // Standard success threshold monitoringWindowMs: 600000, // 10 minute window - longer for BEAM // Phoenix-specific settings customSettings: { // Don't count these as failures ignoredErrors: [ 'GenServer timeout', // Normal in distributed systems 'Process not alive', // Supervision will restart 'Connection closed', // Phoenix will reconnect 'test timeout', // Test timeouts shouldn't trip breakers 'mix test' // Test execution errors handled separately ], // Longer timeouts for specific operations operationTimeouts: { 'database_query': 15000, // 15s for complex queries 'external_api': 20000, // 20s for external calls 'file_upload': 60000, // 1min for uploads 'test_execution': 600000 // 10min for test suites } } }; } /** * Check if an error should be counted towards circuit breaker */ static shouldCountError(error, config) { const message = error.message.toLowerCase(); const ignoredErrors = config.customSettings?.ignoredErrors || []; // Check if error should be ignored for (const ignored of ignoredErrors) { if (message.includes(ignored.toLowerCase())) { return false; } } // Timeout errors in test context shouldn't trip breakers if (message.includes('timeout') && message.includes('test')) { return false; } return true; } /** * Get timeout for specific operation type */ static getOperationTimeout(operationType, config) { const timeouts = config.customSettings?.operationTimeouts || {}; return timeouts[operationType] || config.timeout; } /** * Determine if we should use Phoenix-optimized config */ static shouldUsePhoenixConfig(context) { // Check for Phoenix/Elixir indicators const indicators = [ context.framework === 'phoenix', context.framework === 'elixir', context.ecosystem === 'elixir', context.projectType?.includes('phoenix'), context.hasFile?.('mix.exs'), context.hasFile?.('config/config.exs'), context.testFramework === 'exunit' ]; return indicators.some(indicator => indicator === true); } } //# sourceMappingURL=phoenix-circuit-breaker-config.js.map