diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-12-04 17:58:31 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-12-04 17:58:31 +0000 |
| commit | f639ecfac6687c9e8de4e3f305e168b2e4e1bb87 (patch) | |
| tree | cfcbf16a937a59048930ccaf8557f78ed5576bde /src/config.rs | |
| parent | bf558b0dc17e14f96eea624ea5591315a2909154 (diff) | |
feat(sync): Phase 3 - resilience and health tracking
- Add RelayHealthTracker with DashMap
- Implement exponential backoff (5s -> 1h max)
- Handle dead relays (24h failures -> daily retry)
- Add startup jitter to prevent thundering herd
- Add NGIT_SYNC_MAX_BACKOFF_SECS config
Diffstat (limited to 'src/config.rs')
| -rw-r--r-- | src/config.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/config.rs b/src/config.rs index a2a27be..441a14d 100644 --- a/src/config.rs +++ b/src/config.rs | |||
| @@ -87,6 +87,10 @@ pub struct Config { | |||
| 87 | /// URL of relay to sync kind 30617 events from (optional, enables proactive sync) | 87 | /// URL of relay to sync kind 30617 events from (optional, enables proactive sync) |
| 88 | #[arg(long, env = "NGIT_SYNC_RELAY_URL")] | 88 | #[arg(long, env = "NGIT_SYNC_RELAY_URL")] |
| 89 | pub sync_relay_url: Option<String>, | 89 | pub sync_relay_url: Option<String>, |
| 90 | |||
| 91 | /// Maximum backoff time in seconds for sync relay reconnection (default: 3600 = 1 hour) | ||
| 92 | #[arg(long, env = "NGIT_SYNC_MAX_BACKOFF_SECS", default_value_t = 3600)] | ||
| 93 | pub sync_max_backoff_secs: u64, | ||
| 90 | } | 94 | } |
| 91 | 95 | ||
| 92 | impl Config { | 96 | impl Config { |
| @@ -143,6 +147,7 @@ impl Config { | |||
| 143 | metrics_connection_per_ip_abuse_threshold: 10, | 147 | metrics_connection_per_ip_abuse_threshold: 10, |
| 144 | metrics_top_n_repos: 10, | 148 | metrics_top_n_repos: 10, |
| 145 | sync_relay_url: None, | 149 | sync_relay_url: None, |
| 150 | sync_max_backoff_secs: 3600, | ||
| 146 | } | 151 | } |
| 147 | } | 152 | } |
| 148 | } | 153 | } |