Module: SwarmSDK::Defaults::McpReconnection
- Defined in:
- lib/swarm_sdk/defaults.rb
Overview
MCP reconnection configuration
Settings for automatic reconnection when SSE/streamable connections drop. Note: The background SSE notification stream uses operation_timeout which limits total connection duration. Since this stream is meant to stay open indefinitely for server notifications, we configure aggressive reconnection so timeouts are transparent to users. Tool calls use separate connections and are unaffected by SSE stream timeouts.
Constant Summary collapse
- MAX_RETRIES =
Maximum number of reconnection attempts
Very high value (effectively infinite) because the SSE notification stream is expected to timeout periodically due to operation_timeout limitations. Reconnection is transparent - tool calls continue working regardless.
1000- INITIAL_DELAY_MS =
Initial delay between reconnection attempts (milliseconds)
Fast initial reconnect (500ms) to minimize notification gaps.
500- DELAY_GROW_FACTOR =
Exponential backoff growth factor
Slow growth (1.2x) because we expect frequent reconnections. 500ms -> 600ms -> 720ms -> 864ms -> 1037ms -> ...
1.2- MAX_DELAY_MS =
Maximum delay between reconnection attempts (milliseconds)
Caps at 10 seconds to ensure responsive reconnection even after many retries.
10_000