mirror of
https://github.com/telemt/telemt.git
synced 2026-04-26 15:04:09 +03:00
fix: move tg_connect to general, rustfmt upstream, fix UpstreamManager::new tests
- Relocate tg_connect from [timeouts] to [general] with validation and docs updates. - Apply rustfmt to per-attempt upstream connect timeout expression in upstream.rs. - Pass tg_connect_timeout_secs in all UpstreamManager::new test call sites. - Wire hot reload and runtime snapshot to general.tg_connect.
This commit is contained in:
@@ -317,7 +317,7 @@ pub struct UpstreamManager {
|
||||
connect_retry_attempts: u32,
|
||||
connect_retry_backoff: Duration,
|
||||
connect_budget: Duration,
|
||||
/// Per-attempt TCP connect timeout to Telegram DC (`[timeouts] tg_connect`, seconds).
|
||||
/// Per-attempt TCP connect timeout to Telegram DC (`[general] tg_connect`, seconds).
|
||||
tg_connect_timeout_secs: u64,
|
||||
unhealthy_fail_threshold: u32,
|
||||
connect_failfast_hard_errors: bool,
|
||||
@@ -799,8 +799,8 @@ impl UpstreamManager {
|
||||
break;
|
||||
}
|
||||
let remaining_budget = self.connect_budget.saturating_sub(elapsed);
|
||||
let attempt_timeout = Duration::from_secs(self.tg_connect_timeout_secs)
|
||||
.min(remaining_budget);
|
||||
let attempt_timeout =
|
||||
Duration::from_secs(self.tg_connect_timeout_secs).min(remaining_budget);
|
||||
if attempt_timeout.is_zero() {
|
||||
last_error = Some(ProxyError::ConnectionTimeout {
|
||||
addr: target.to_string(),
|
||||
|
||||
Reference in New Issue
Block a user