Explorar o código

etcdmain: verify heartbeat and election flag

Xiang Li %!s(int64=10) %!d(string=hai) anos
pai
achega
ed8c3534e9
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      etcdmain/config.go

+ 4 - 0
etcdmain/config.go

@@ -255,6 +255,10 @@ func (cfg *config) Parse(arguments []string) error {
 		return errors.New("cannot resolve DNS hostnames.")
 	}
 
+	if 5*cfg.TickMs > cfg.ElectionMs {
+		return fmt.Errorf("-election-timeout[%vms] should be at least as 5 times as -heartbeat-interval[%vms]", cfg.ElectionMs, cfg.TickMs)
+	}
+
 	return nil
 }