Override default gocql reconnection policy
@@ -32,6 +32,7 @@ import (
"fmt"
"io/ioutil"
"strings"
+ "time"
"github.com/gocql/gocql"
@@ -139,6 +140,12 @@ func NewCassandraCluster(cfg config.Cassandra, r resolver.ServiceResolver) (*goc
cluster.ConnectTimeout = cfg.ConnectTimeout
}
+ cluster.ReconnectionPolicy = &gocql.ExponentialReconnectionPolicy{
+ MaxRetries: 30,
+ InitialInterval: 1 * time.Second,
+ MaxInterval: 8 * time.Second,
+ }
+
cluster.PoolConfig.HostSelectionPolicy = gocql.TokenAwareHostPolicy(gocql.RoundRobinHostPolicy())
return cluster, nil
}
