Browse Source

chore(etcd): loose request timeout

This is a hack to improve multi-etcd boot process.
It could make users alwasy start etcd cluster successfully.
Yicheng Qin 11 years ago
parent
commit
3a5cb26973
1 changed files with 8 additions and 2 deletions
  1. 8 2
      etcd/etcd.go

+ 8 - 2
etcd/etcd.go

@@ -134,8 +134,14 @@ func (e *Etcd) Run() {
 	// Calculate all of our timeouts
 	heartbeatInterval := time.Duration(e.Config.Peer.HeartbeatInterval) * time.Millisecond
 	electionTimeout := time.Duration(e.Config.Peer.ElectionTimeout) * time.Millisecond
-	dialTimeout := (3 * heartbeatInterval) + electionTimeout
-	responseHeaderTimeout := (3 * heartbeatInterval) + electionTimeout
+	// TODO(yichengq): constant 1000 is a hack here. The reason to use this
+	// is to ensure etcd instances could start successfully at the same time.
+	// Current problem for the failure comes from the lag between join command
+	// execution and join success.
+	// Fix it later. It should be removed when proper method is found and
+	// enough tests are provided.
+	dialTimeout := (3 * heartbeatInterval) + electionTimeout + 1000
+	responseHeaderTimeout := (3 * heartbeatInterval) + electionTimeout + 1000
 
 	// Create peer server
 	psConfig := server.PeerServerConfig{