Skip to content

Commit

Permalink
Make Signal ping kill and rebuild websocket if it takes more than 20s (
Browse files Browse the repository at this point in the history
  • Loading branch information
smweber committed May 1, 2024
1 parent 73e7619 commit b602e94
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/signalmeow/web/signalwebsocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,12 @@ func (s *SignalWebsocket) connectLoop(
for {
select {
case <-ticker.C:
err := ws.Ping(loopCtx)
pingCtx, cancel := context.WithTimeout(loopCtx, 20*time.Second)
err := ws.Ping(pingCtx)
cancel()
if err != nil {
loopCancel(fmt.Errorf("error sending keepalive: %w", err))
log.Err(err).Msg("Error pinging")
loopCancel(err)
return
}
log.Debug().Msg("Sent keepalive")
Expand Down

0 comments on commit b602e94

Please sign in to comment.