1
0
mirror of https://github.com/TwiN/gatus.git synced 2026-02-04 15:14:43 +00:00

fix(tunneling): Adjust exponential backoff duration

This commit is contained in:
TwiN
2025-09-30 14:27:38 -04:00
parent 405c15f756
commit c7f0a32135
4 changed files with 7 additions and 4 deletions

View File

@@ -745,6 +745,9 @@ endpoints:
- "[STATUS] == 200" - "[STATUS] == 200"
``` ```
> ⚠️ **WARNING**:: Tunneling may introduce additional latency, especially if the connection to the tunnel is retried frequently.
> This may lead to inaccurate response time measurements.
### Alerting ### Alerting
Gatus supports multiple alerting providers, such as Slack and PagerDuty, and supports different alerts for each Gatus supports multiple alerting providers, such as Slack and PagerDuty, and supports different alerts for each

View File

@@ -131,11 +131,11 @@ func (t *SSHTunnel) Dial(network, addr string) (net.Conn, error) {
} }
// Attempt dial with exponential backoff retry // Attempt dial with exponential backoff retry
const maxRetries = 3 const maxRetries = 3
const baseDelay = time.Second const baseDelay = 500 * time.Millisecond
var lastErr error var lastErr error
for attempt := 0; attempt < maxRetries; attempt++ { for attempt := 0; attempt < maxRetries; attempt++ {
if attempt > 0 { if attempt > 0 {
// Exponential backoff: 1s, 2s, 4s // Exponential backoff: 500ms, 1s, 2s
delay := baseDelay << (attempt - 1) delay := baseDelay << (attempt - 1)
time.Sleep(delay) time.Sleep(delay)
// Close stale connection and reconnect // Close stale connection and reconnect