Skip to content

Commit 4b63486

Browse files
committed
signalmeow/web: add small sleep for all reconnects
1 parent b01a912 commit 4b63486

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/signalmeow/web/signalwebsocket.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ func (s *SignalWebsocket) connectLoop(
186186
backoff := initialBackoff
187187
retrying := false
188188
errorCount := 0
189+
isFirstConnect := true
189190
for {
190191
if retrying {
191192
if backoff > maxBackoff {
@@ -194,11 +195,14 @@ func (s *SignalWebsocket) connectLoop(
194195
log.Warn().Dur("backoff", backoff).Msg("Failed to connect, waiting to retry...")
195196
time.Sleep(backoff)
196197
backoff += backoffIncrement
198+
} else if !isFirstConnect {
199+
time.Sleep(1 * time.Second)
197200
}
198201
if ctx.Err() != nil {
199202
log.Info().Msg("ctx done, stopping connection loop")
200203
return
201204
}
205+
isFirstConnect = false
202206

203207
ws, resp, err := OpenWebsocket(ctx, s.path)
204208
if resp != nil {

0 commit comments

Comments
 (0)