mirror of
https://github.com/kubernetes-sigs/external-dns.git
synced 2025-08-07 10:06:57 +02:00
parent
e664bde484
commit
daeda2ed53
@ -66,14 +66,15 @@ func (c *Controller) RunOnce() error {
|
|||||||
|
|
||||||
// Run runs RunOnce in a loop with a delay until stopChan receives a value.
|
// Run runs RunOnce in a loop with a delay until stopChan receives a value.
|
||||||
func (c *Controller) Run(stopChan <-chan struct{}) {
|
func (c *Controller) Run(stopChan <-chan struct{}) {
|
||||||
|
ticker := time.NewTicker(c.Interval)
|
||||||
|
defer ticker.Stop()
|
||||||
for {
|
for {
|
||||||
err := c.RunOnce()
|
err := c.RunOnce()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-time.After(c.Interval):
|
case <-ticker.C:
|
||||||
case <-stopChan:
|
case <-stopChan:
|
||||||
log.Info("Terminating main controller loop")
|
log.Info("Terminating main controller loop")
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user