Skip to content

Commit

Permalink
etcdserver: make tick duration calculation clear
Browse files Browse the repository at this point in the history
  • Loading branch information
xiang90 committed Sep 23, 2017
1 parent 2303232 commit 44f3686
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions etcdserver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,16 +173,16 @@ func (c *ServerConfig) ShouldDiscover() bool { return c.DiscoveryURL != "" }
func (c *ServerConfig) ReqTimeout() time.Duration {
// 5s for queue waiting, computation and disk IO delay
// + 2 * election timeout for possible leader election
return 5*time.Second + 2*time.Duration(c.ElectionTicks)*time.Duration(c.TickMs)*time.Millisecond
return 5*time.Second + 2*time.Duration(c.ElectionTicks*c.TickMs)*time.Millisecond
}

func (c *ServerConfig) electionTimeout() time.Duration {
return time.Duration(c.ElectionTicks) * time.Duration(c.TickMs) * time.Millisecond
return time.Duration(c.ElectionTicks*c.TickMs) * time.Millisecond
}

func (c *ServerConfig) peerDialTimeout() time.Duration {
// 1s for queue wait and election timeout
return time.Second + time.Duration(c.ElectionTicks)*time.Duration(c.TickMs)*time.Millisecond
return time.Second + time.Duration(c.ElectionTicks*c.TickMs)*time.Millisecond
}

func (c *ServerConfig) PrintWithInitial() { c.print(true) }
Expand Down

0 comments on commit 44f3686

Please sign in to comment.