Parcourir la source

etcd: fix cluster sync

Xiang Li il y a 11 ans
Parent
commit
9756dba57a
1 fichiers modifiés avec 2 ajouts et 1 suppressions
  1. 2 1
      etcd/etcd.go

+ 2 - 1
etcd/etcd.go

@@ -394,7 +394,7 @@ func (s *Server) runParticipant() {
 }
 }
 
 
 func (s *Server) runStandby() {
 func (s *Server) runStandby() {
-	syncDuration := time.Duration(0)
+	var syncDuration time.Duration
 	for {
 	for {
 		select {
 		select {
 		case <-time.After(syncDuration):
 		case <-time.After(syncDuration):
@@ -407,6 +407,7 @@ func (s *Server) runStandby() {
 			log.Println("standby sync:", err)
 			log.Println("standby sync:", err)
 			continue
 			continue
 		}
 		}
+		syncDuration = time.Duration(s.clusterConf.SyncInterval * float64(time.Second))
 		if s.clusterConf.ActiveSize <= len(s.nodes) {
 		if s.clusterConf.ActiveSize <= len(s.nodes) {
 			continue
 			continue
 		}
 		}