Skip to content

Commit

Permalink
Increase frequency of PING checks when using low (<10s) KeepAlive
Browse files Browse the repository at this point in the history
fix keep-alive timeouts on small intervals
  • Loading branch information
MattBrittan authored Feb 9, 2024
2 parents 41dbed3 + 08d0637 commit f21bdb1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ping.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func keepalive(c *client, conn io.Writer) {
if c.options.KeepAlive > 10 {
checkInterval = 5 * time.Second
} else {
checkInterval = time.Duration(c.options.KeepAlive) * time.Second / 2
checkInterval = time.Duration(c.options.KeepAlive) * time.Second / 4
}

intervalTicker := time.NewTicker(checkInterval)
Expand Down

0 comments on commit f21bdb1

Please sign in to comment.