|
Entropic 2.11.1
Local-first agentic inference engine
|
Exponential backoff with jitter for reconnection attempts. More...
#include <entropic/mcp/reconnect_policy.h>
Public Member Functions | |
| ReconnectPolicy (uint32_t base_delay_ms=1000, uint32_t max_delay_ms=60000, uint32_t max_retries=5, double backoff_factor=2.0) | |
| Construct with explicit parameters. | |
| ReconnectPolicy (const ReconnectConfig &config) | |
| Construct from config struct. | |
| uint32_t | delay_ms (uint32_t attempt) const |
| Compute delay for the given attempt number. | |
| bool | exhausted (uint32_t attempt) const |
| Check if retries are exhausted. | |
Exponential backoff with jitter for reconnection attempts.
delay(n) = min(base * factor^n, max) + jitter(0, delay*0.1)
Definition at line 27 of file reconnect_policy.h.
| entropic::ReconnectPolicy::ReconnectPolicy | ( | uint32_t | base_delay_ms = 1000, |
| uint32_t | max_delay_ms = 60000, |
||
| uint32_t | max_retries = 5, |
||
| double | backoff_factor = 2.0 |
||
| ) |
Construct with explicit parameters.
| base_delay_ms | Base delay in milliseconds. |
| max_delay_ms | Maximum delay cap. |
| max_retries | Maximum attempts (0 = infinite). |
| backoff_factor | Multiplicative factor per attempt. |
| base_delay_ms | Base delay. |
| max_delay_ms | Maximum delay cap. |
| max_retries | Maximum attempts (0 = infinite). |
| backoff_factor | Exponential multiplier. @dg_internal |
Definition at line 25 of file reconnect_policy.cpp.
|
explicit |
Construct from config struct.
| config | ReconnectConfig with all parameters. |
| config | ReconnectConfig. @dg_internal |
Definition at line 41 of file reconnect_policy.cpp.
| uint32_t entropic::ReconnectPolicy::delay_ms | ( | uint32_t | attempt | ) | const |
Compute delay for the given attempt number.
Compute delay with exponential backoff and jitter.
| attempt | Zero-based attempt number. |
| attempt | Zero-based attempt number. |
base_delay * factor^attempt, capped at max_delay, plus a uniform jitter of up to 10% of the capped value — so delay grows exponentially, saturates at max_delay, and repeated reconnects across servers do not synchronise. @req REQ-MCP-025 Definition at line 57 of file reconnect_policy.cpp.
| bool entropic::ReconnectPolicy::exhausted | ( | uint32_t | attempt | ) | const |
Check if retries are exhausted.
| attempt | Zero-based attempt number. |
| attempt | Zero-based attempt number. |
attempt reaches max_retries; always false when max_retries is 0, which means "retry forever". @req REQ-MCP-025 Definition at line 78 of file reconnect_policy.cpp.