mirror of
https://github.com/TwiN/gatus.git
synced 2026-02-16 05:11:11 +00:00
fix(tunneling): Adjust exponential backoff duration
This commit is contained in:
@@ -131,11 +131,11 @@ func (t *SSHTunnel) Dial(network, addr string) (net.Conn, error) {
|
||||
}
|
||||
// Attempt dial with exponential backoff retry
|
||||
const maxRetries = 3
|
||||
const baseDelay = time.Second
|
||||
const baseDelay = 500 * time.Millisecond
|
||||
var lastErr error
|
||||
for attempt := 0; attempt < maxRetries; attempt++ {
|
||||
if attempt > 0 {
|
||||
// Exponential backoff: 1s, 2s, 4s
|
||||
// Exponential backoff: 500ms, 1s, 2s
|
||||
delay := baseDelay << (attempt - 1)
|
||||
time.Sleep(delay)
|
||||
// Close stale connection and reconnect
|
||||
|
||||
Reference in New Issue
Block a user