Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions client_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ type ClientPolicy struct {
// Minimum possible interval is 10 Milliseconds.
TendInterval time.Duration //= 1 second

// Initial cluster connection timeout duration.
// The timeout when connecting to the cluster for the first time.
TendTimeout time.Duration //= 30 seconds

// A IP translation table is used in cases where different clients
// use different server IP addresses. This may be necessary when
// using clients from both inside and outside a local area
Expand Down Expand Up @@ -95,6 +99,7 @@ type ClientPolicy struct {
func NewClientPolicy() *ClientPolicy {
return &ClientPolicy{
Timeout: 30 * time.Second,
TendTimeout: 30 * time.Second,
IdleTimeout: defaultIdleTimeout,
ConnectionQueueSize: 256,
FailIfNotConnected: true,
Expand Down
4 changes: 2 additions & 2 deletions cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ func (clstr *Cluster) waitTillStabilized() error {
}()

select {
case <-time.After(clstr.clientPolicy.Timeout):
case <-time.After(clstr.clientPolicy.TendTimeout):
return errors.New("Connecting to the cluster timed out.")
case err := <-doneCh:
return err
Expand Down Expand Up @@ -608,7 +608,7 @@ L:
case <-successChan:
// even one seed is enough
return true, nil
case <-time.After(clstr.clientPolicy.Timeout):
case <-time.After(clstr.clientPolicy.TendTimeout):
// time is up, no seeds found
wg.Wait()
break L
Expand Down