From 851026362af417277ac05927339fcf5b01184be9 Mon Sep 17 00:00:00 2001 From: Yicheng Qin Date: Wed, 14 May 2014 10:13:05 -0400 Subject: [PATCH] chore(standby_server): let syncInterval represent in second unit This is done to keep consistency with other namings. --- server/standby_server.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/standby_server.go b/server/standby_server.go index b0f093108..a1c6c95dd 100644 --- a/server/standby_server.go +++ b/server/standby_server.go @@ -27,7 +27,7 @@ type StandbyServer struct { client *Client cluster []*machineMessage - syncInterval time.Duration + syncInterval float64 joinIndex uint64 removeNotify chan bool @@ -42,7 +42,7 @@ func NewStandbyServer(config StandbyServerConfig, client *Client) *StandbyServer return &StandbyServer{ Config: config, client: client, - syncInterval: time.Duration(int64(DefaultSyncInterval * float64(time.Second))), + syncInterval: DefaultSyncInterval, } } @@ -118,7 +118,7 @@ func (s *StandbyServer) SyncCluster(peers []string) error { } func (s *StandbyServer) SetSyncInterval(second float64) { - s.syncInterval = time.Duration(int64(second * float64(time.Second))) + s.syncInterval = second } func (s *StandbyServer) ClusterLeader() *machineMessage { @@ -146,7 +146,7 @@ func (s *StandbyServer) redirectRequests(w http.ResponseWriter, r *http.Request) func (s *StandbyServer) monitorCluster() { for { - timer := time.NewTimer(s.syncInterval) + timer := time.NewTimer(time.Duration(int64(s.syncInterval * float64(time.Second)))) defer timer.Stop() select { case <-s.closeChan: