From d9e0e0e0afd5edf3dc0a28f57840dd4a00f601c0 Mon Sep 17 00:00:00 2001 From: Renato Alcara Date: Sun, 26 Apr 2026 22:49:27 -0300 Subject: [PATCH] refactor(types): drop circuit-breaker SocketConfig fields and default Removes the 5 optional circuit-breaker config fields exposed via SocketConfig and the corresponding default in DEFAULT_CONNECTION_CONFIG: - enableCircuitBreaker - queryCircuitBreaker - connectionCircuitBreaker - preKeyCircuitBreaker - messageCircuitBreaker Also drops the CircuitBreakerOptions import. Backward compatibility: these were ALL optional. Callers that set them will see no compile error (TypeScript accepts unknown extra props on loose object literals through structural typing) and the values are simply ignored. A future major version may want to mark these as forbidden with a more aggressive type, but for now silent ignore is the least intrusive transition. --- src/Defaults/index.ts | 2 -- src/Types/Socket.ts | 18 ------------------ 2 files changed, 20 deletions(-) diff --git a/src/Defaults/index.ts b/src/Defaults/index.ts index 11885d93..e36976a3 100644 --- a/src/Defaults/index.ts +++ b/src/Defaults/index.ts @@ -142,8 +142,6 @@ export const DEFAULT_CONNECTION_CONFIG: SocketConfig = { getMessage: async () => undefined, cachedGroupMetadata: async () => undefined, makeSignalRepository: makeLibSignalRepository, - // Circuit breaker configuration - enableCircuitBreaker: true, // Listener limits (memory leak prevention) // WebSocket: 8 core events (open, close, error, message, ping, pong, upgrade, unexpected-response) // + 10 dynamic listeners (reconnect handlers, custom events) diff --git a/src/Types/Socket.ts b/src/Types/Socket.ts index 800f4cba..38e97cd6 100644 --- a/src/Types/Socket.ts +++ b/src/Types/Socket.ts @@ -1,7 +1,6 @@ import type { Agent } from 'https' import type { URL } from 'url' import { proto } from '../../WAProto/index.js' -import type { CircuitBreakerOptions } from '../Utils/circuit-breaker' import type { ILogger } from '../Utils/logger' import type { AuthenticationState, LIDMapping, SignalAuthState, TransactionCapabilityOptions } from './Auth' import type { GroupMetadata } from './GroupMetadata' @@ -203,23 +202,6 @@ export type SocketConfig = { pnToLIDFunc?: (jids: string[]) => Promise ) => SignalRepositoryWithLIDStore - // === Circuit Breaker Configuration === - - /** Enable circuit breaker protection for socket operations (default: true) */ - enableCircuitBreaker?: boolean - - /** Circuit breaker configuration for query operations */ - queryCircuitBreaker?: Partial - - /** Circuit breaker configuration for connection operations */ - connectionCircuitBreaker?: Partial - - /** Circuit breaker configuration for pre-key operations */ - preKeyCircuitBreaker?: Partial - - /** Circuit breaker configuration for message operations */ - messageCircuitBreaker?: Partial - // === Listener Limits (Memory Leak Prevention) === /**