diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-12-11 11:19:38 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-12-11 11:19:38 +0000 |
| commit | c82684092c7b4f81e49833b0888500fcb9851218 (patch) | |
| tree | 6853940a5bb975aa17e1f91be988e3b3303ff39f /src/config.rs | |
| parent | 532a7d0d5d8461bad0fc799aacb5eea0135f79f3 (diff) | |
fix(sync): improve metrics recording and connection failure detection
Changes:
- Fix connection attempt metrics: record success/failure based on actual
connection result instead of pre-emptively recording failure
- Add health tracker integration on connection failure: call
record_failure() and record_health_state() in error path
- Add connection verification in relay_connection.rs: wait 500ms after
connect() then verify is_connected() to detect silent failures
- Add configurable disconnect check interval via
NGIT_SYNC_DISCONNECT_CHECK_INTERVAL_SECS env var
- Update TestRelay with fast test settings: startup_delay=0, jitter=0,
disconnect_check_interval=1s
- Add debug output to metrics tests for investigation
Note: Tests may still fail due to 5-second base backoff in health tracker.
A follow-up task will add NGIT_SYNC_BASE_BACKOFF_SECS config parameter
to allow faster test cycles.
Related: metrics-wiring-plan.md Tasks 1 & 2
Diffstat (limited to 'src/config.rs')
| -rw-r--r-- | src/config.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/config.rs b/src/config.rs index 69a160a..5e74471 100644 --- a/src/config.rs +++ b/src/config.rs | |||
| @@ -109,6 +109,11 @@ pub struct Config { | |||
| 109 | /// Set to 0 to disable jitter (useful for testing) | 109 | /// Set to 0 to disable jitter (useful for testing) |
| 110 | #[arg(long, env = "NGIT_SYNC_STARTUP_JITTER_MS", default_value_t = 10_000)] | 110 | #[arg(long, env = "NGIT_SYNC_STARTUP_JITTER_MS", default_value_t = 10_000)] |
| 111 | pub sync_startup_jitter_ms: u64, | 111 | pub sync_startup_jitter_ms: u64, |
| 112 | |||
| 113 | /// Interval in seconds for checking disconnected relays and attempting reconnection (default: 60) | ||
| 114 | /// Set to lower value for faster reconnection testing | ||
| 115 | #[arg(long, env = "NGIT_SYNC_DISCONNECT_CHECK_INTERVAL_SECS", default_value_t = 60)] | ||
| 116 | pub sync_disconnect_check_interval_secs: u64, | ||
| 112 | } | 117 | } |
| 113 | 118 | ||
| 114 | impl Config { | 119 | impl Config { |
| @@ -170,6 +175,7 @@ impl Config { | |||
| 170 | sync_reconnect_delay_secs: 10, | 175 | sync_reconnect_delay_secs: 10, |
| 171 | sync_reconnect_lookback_days: 3, | 176 | sync_reconnect_lookback_days: 3, |
| 172 | sync_startup_jitter_ms: 10_000, | 177 | sync_startup_jitter_ms: 10_000, |
| 178 | sync_disconnect_check_interval_secs: 60, | ||
| 173 | } | 179 | } |
| 174 | } | 180 | } |
| 175 | } | 181 | } |