Class: Quonfig::SSEConfigClient::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/quonfig/sse_config_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sse_read_timeout: 90, seconds_between_new_connection: 5, sleep_delay_for_new_connection_check: 1, sse_default_reconnect_time: SSE::Client::DEFAULT_RECONNECT_TIME, sse_reconnect_reset_interval: 1, errors_to_close_connection: [HTTP::ConnectionError]) ⇒ Options

sse_read_timeout: 90s = 3x the 30s server heartbeat. A silent socket stall trips the read deadline within one missed-heartbeat window rather than the previous 5-minute idle. See plan ‘project/plans/sdk-hardening-and-verification.md` Layer 1.

sse_reconnect_reset_interval: 1s (ld-eventsource default is 60s). The ld-eventsource backoff only resets to the base interval once a connection has stayed up this long; until then each reconnect doubles the delay (1s, 2s, 4s, 8s…). With the 60s default, a flapping connection (chaos scenario 09 — proxy killed every 6s) backs off so fast the SDK is mid-sleep when the next kill lands and never observes it. Resetting after 1s of healthy connection mirrors sdk-python, which resets its backoff on every successful connect (sdk-python/quonfig/ sse.py). A sustained outage still backs off exponentially: no connection succeeds, so ‘mark_success` is never called and the reset never triggers (qfg-ie49).



91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/quonfig/sse_config_client.rb', line 91

def initialize(sse_read_timeout: 90,
               seconds_between_new_connection: 5,
               sleep_delay_for_new_connection_check: 1,
               sse_default_reconnect_time: SSE::Client::DEFAULT_RECONNECT_TIME,
               sse_reconnect_reset_interval: 1,
               errors_to_close_connection: [HTTP::ConnectionError])
  @sse_read_timeout = sse_read_timeout
  @seconds_between_new_connection = seconds_between_new_connection
  @sse_default_reconnect_time = sse_default_reconnect_time
  @sse_reconnect_reset_interval = sse_reconnect_reset_interval
  @sleep_delay_for_new_connection_check = sleep_delay_for_new_connection_check
  @errors_to_close_connection = errors_to_close_connection
end

Instance Attribute Details

#errors_to_close_connectionObject (readonly)

Returns the value of attribute errors_to_close_connection.



71
72
73
# File 'lib/quonfig/sse_config_client.rb', line 71

def errors_to_close_connection
  @errors_to_close_connection
end

#seconds_between_new_connectionObject (readonly)

Returns the value of attribute seconds_between_new_connection.



71
72
73
# File 'lib/quonfig/sse_config_client.rb', line 71

def seconds_between_new_connection
  @seconds_between_new_connection
end

#sleep_delay_for_new_connection_checkObject (readonly)

Returns the value of attribute sleep_delay_for_new_connection_check.



71
72
73
# File 'lib/quonfig/sse_config_client.rb', line 71

def sleep_delay_for_new_connection_check
  @sleep_delay_for_new_connection_check
end

#sse_default_reconnect_timeObject (readonly)

Returns the value of attribute sse_default_reconnect_time.



71
72
73
# File 'lib/quonfig/sse_config_client.rb', line 71

def sse_default_reconnect_time
  @sse_default_reconnect_time
end

#sse_read_timeoutObject (readonly)

Returns the value of attribute sse_read_timeout.



71
72
73
# File 'lib/quonfig/sse_config_client.rb', line 71

def sse_read_timeout
  @sse_read_timeout
end

#sse_reconnect_reset_intervalObject (readonly)

Returns the value of attribute sse_reconnect_reset_interval.



71
72
73
# File 'lib/quonfig/sse_config_client.rb', line 71

def sse_reconnect_reset_interval
  @sse_reconnect_reset_interval
end