Skip to content

Commit

Permalink
Enable SocketKeepalive with 15s by default (matches Golang's default)
Browse files Browse the repository at this point in the history
  • Loading branch information
sylwiaszunejko committed Apr 25, 2024
1 parent 688ac8e commit c953389
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ type ClusterConfig struct {
// Default reconnection policy to use for reconnecting before trying to mark host as down.
ReconnectionPolicy ReconnectionPolicy

// The keepalive period to use, enabled if > 0 (default: 0)
// The keepalive period to use, enabled if > 0 (default: 15 seconds)
// SocketKeepalive is used to set up the default dialer and is ignored if Dialer or HostDialer is provided.
SocketKeepalive time.Duration

Expand Down Expand Up @@ -290,6 +290,7 @@ func NewCluster(hosts ...string) *ClusterConfig {
ReconnectInterval: 60 * time.Second,
ConvictionPolicy: &SimpleConvictionPolicy{},
ReconnectionPolicy: &ConstantReconnectionPolicy{MaxRetries: 3, Interval: 1 * time.Second},
SocketKeepalive: 15 * time.Second,
WriteCoalesceWaitTime: 200 * time.Microsecond,
}

Expand Down

0 comments on commit c953389

Please sign in to comment.