mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
chore(standby_server): let syncInterval represent in second unit
This is done to keep consistency with other namings.
This commit is contained in:
@@ -27,7 +27,7 @@ type StandbyServer struct {
|
|||||||
client *Client
|
client *Client
|
||||||
|
|
||||||
cluster []*machineMessage
|
cluster []*machineMessage
|
||||||
syncInterval time.Duration
|
syncInterval float64
|
||||||
joinIndex uint64
|
joinIndex uint64
|
||||||
|
|
||||||
removeNotify chan bool
|
removeNotify chan bool
|
||||||
@@ -42,7 +42,7 @@ func NewStandbyServer(config StandbyServerConfig, client *Client) *StandbyServer
|
|||||||
return &StandbyServer{
|
return &StandbyServer{
|
||||||
Config: config,
|
Config: config,
|
||||||
client: client,
|
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) {
|
func (s *StandbyServer) SetSyncInterval(second float64) {
|
||||||
s.syncInterval = time.Duration(int64(second * float64(time.Second)))
|
s.syncInterval = second
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StandbyServer) ClusterLeader() *machineMessage {
|
func (s *StandbyServer) ClusterLeader() *machineMessage {
|
||||||
@@ -146,7 +146,7 @@ func (s *StandbyServer) redirectRequests(w http.ResponseWriter, r *http.Request)
|
|||||||
|
|
||||||
func (s *StandbyServer) monitorCluster() {
|
func (s *StandbyServer) monitorCluster() {
|
||||||
for {
|
for {
|
||||||
timer := time.NewTimer(s.syncInterval)
|
timer := time.NewTimer(time.Duration(int64(s.syncInterval * float64(time.Second))))
|
||||||
defer timer.Stop()
|
defer timer.Stop()
|
||||||
select {
|
select {
|
||||||
case <-s.closeChan:
|
case <-s.closeChan:
|
||||||
|
|||||||
Reference in New Issue
Block a user