diff --git a/client/consul/sync.go b/client/consul/sync.go index 507bab9d4..5e8cdf360 100644 --- a/client/consul/sync.go +++ b/client/consul/sync.go @@ -351,10 +351,10 @@ func (c *Syncer) deregisterCheck(ID string) error { return c.client.Agent().CheckDeregister(ID) } -// PeriodicSync triggers periodic syncing of services and checks with Consul. -// This is a long lived go-routine which is stopped during shutdown -func (c *Syncer) PeriodicSync() { sync := time.NewTicker(syncInterval) +// Run triggers periodic syncing of services and checks with Consul. This is +// a long lived go-routine which is stopped during shutdown. +func (c *Syncer) Run() { for { select { case <-sync.C: diff --git a/client/driver/executor/executor.go b/client/driver/executor/executor.go index 54f597fee..3b9ac1b46 100644 --- a/client/driver/executor/executor.go +++ b/client/driver/executor/executor.go @@ -484,7 +484,7 @@ func (e *UniversalExecutor) SyncServices(ctx *ConsulContext) error { e.interpolateServices(e.ctx.Task) } err := e.consulSyncer.SyncServices(e.ctx.Task.Services) - go e.consulSyncer.PeriodicSync() + go e.consulSyncer.Run() return err } diff --git a/command/agent/agent.go b/command/agent/agent.go index 2aa05e195..8807d8d19 100644 --- a/command/agent/agent.go +++ b/command/agent/agent.go @@ -74,7 +74,7 @@ func NewAgent(config *Config, logOutput io.Writer) (*Agent, error) { a.logger.Printf("[ERR] agent: unable to sync agent services with consul: %v", err) } if a.consulSyncer != nil { - go a.consulSyncer.PeriodicSync() + go a.consulSyncer.Run() } }