From 4b634863890e7818febc8b9b8341da52ccf61cb6 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Tue, 17 Dec 2024 12:48:56 +0200 Subject: [PATCH] signalmeow/web: add small sleep for all reconnects --- pkg/signalmeow/web/signalwebsocket.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/signalmeow/web/signalwebsocket.go b/pkg/signalmeow/web/signalwebsocket.go index 4ac1bf0e..3b192fba 100644 --- a/pkg/signalmeow/web/signalwebsocket.go +++ b/pkg/signalmeow/web/signalwebsocket.go @@ -186,6 +186,7 @@ func (s *SignalWebsocket) connectLoop( backoff := initialBackoff retrying := false errorCount := 0 + isFirstConnect := true for { if retrying { if backoff > maxBackoff { @@ -194,11 +195,14 @@ func (s *SignalWebsocket) connectLoop( log.Warn().Dur("backoff", backoff).Msg("Failed to connect, waiting to retry...") time.Sleep(backoff) backoff += backoffIncrement + } else if !isFirstConnect { + time.Sleep(1 * time.Second) } if ctx.Err() != nil { log.Info().Msg("ctx done, stopping connection loop") return } + isFirstConnect = false ws, resp, err := OpenWebsocket(ctx, s.path) if resp != nil {