mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-22 18:16:52 +00:00
Make interval a constant on proxy/config/etcd
Allow future testing of intervals
This commit is contained in:
parent
2284e5d5f5
commit
786b0399c3
@ -51,6 +51,7 @@ type ConfigSourceEtcd struct {
|
|||||||
client *etcd.Client
|
client *etcd.Client
|
||||||
serviceChannel chan ServiceUpdate
|
serviceChannel chan ServiceUpdate
|
||||||
endpointsChannel chan EndpointsUpdate
|
endpointsChannel chan EndpointsUpdate
|
||||||
|
interval time.Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewConfigSourceEtcd creates a new ConfigSourceEtcd and immediately runs the created ConfigSourceEtcd in a goroutine.
|
// NewConfigSourceEtcd creates a new ConfigSourceEtcd and immediately runs the created ConfigSourceEtcd in a goroutine.
|
||||||
@ -59,6 +60,7 @@ func NewConfigSourceEtcd(client *etcd.Client, serviceChannel chan ServiceUpdate,
|
|||||||
client: client,
|
client: client,
|
||||||
serviceChannel: serviceChannel,
|
serviceChannel: serviceChannel,
|
||||||
endpointsChannel: endpointsChannel,
|
endpointsChannel: endpointsChannel,
|
||||||
|
interval: 2 * time.Second,
|
||||||
}
|
}
|
||||||
go config.Run()
|
go config.Run()
|
||||||
return config
|
return config
|
||||||
@ -76,7 +78,7 @@ func (s ConfigSourceEtcd) Run() {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
glog.Errorf("Failed to get any services: %v", err)
|
glog.Errorf("Failed to get any services: %v", err)
|
||||||
time.Sleep(2 * time.Second)
|
time.Sleep(s.interval)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(services) > 0 {
|
if len(services) > 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user