/** * Sync Circuit Breaker * * Prevents sync storms when external services (GitHub, JIRA, ADO) are down. * * Pattern: Circuit Breaker (Microservices pattern) * States: * - CLOSED: Normal operation, syncs allowed * - OPEN: Too many failures, syncs blocked * - HALF_OPEN: Testing if service recovered * * Thresholds: * - Opens after 3 consecutive failures * - Auto-resets after 5 minutes * - Closes on first success in HALF_OPEN state */ export type CircuitState = 'closed' | 'open' | 'half-open'; export interface CircuitBreakerState { state: CircuitState; failures: number; lastFailure?: Date; } export declare class SyncCircuitBreaker { private failures; private lastFailure?; private state; private readonly FAILURE_THRESHOLD; private readonly RESET_TIMEOUT_MS; /** * Check if sync is allowed * * @returns true if sync should proceed, false if circuit is open */ canSync(): boolean; /** * Record successful sync * * Resets failure count and closes circuit */ recordSuccess(): void; /** * Record failed sync * * Increments failure count and opens circuit if threshold exceeded */ recordFailure(): void; /** * Check if circuit should reset * * @returns true if timeout elapsed */ private shouldReset; /** * Get current circuit state * * @returns Circuit state info */ getState(): CircuitBreakerState; /** * Manually reset circuit (for testing/admin) */ reset(): void; } //# sourceMappingURL=sync-circuit-breaker.d.ts.map