Remove initial delay of registering services with consul
This commit is contained in:
parent
3bef934580
commit
751b2e1bcb
|
@ -752,14 +752,11 @@ func (c *Syncer) deregisterCheck(checkID string) error {
|
||||||
// Run triggers periodic syncing of services and checks with Consul. This is
|
// Run triggers periodic syncing of services and checks with Consul. This is
|
||||||
// a long lived go-routine which is stopped during shutdown.
|
// a long lived go-routine which is stopped during shutdown.
|
||||||
func (c *Syncer) Run() {
|
func (c *Syncer) Run() {
|
||||||
d := initialSyncDelay + lib.RandomStagger(initialSyncBuffer-initialSyncDelay)
|
sync := time.NewTimer(0)
|
||||||
sync := time.NewTimer(d)
|
|
||||||
c.logger.Printf("[DEBUG] consul.syncer: sleeping %v before first sync", d)
|
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-sync.C:
|
case <-sync.C:
|
||||||
d = syncInterval - lib.RandomStagger(syncInterval/syncJitter)
|
d := syncInterval - lib.RandomStagger(syncInterval/syncJitter)
|
||||||
sync.Reset(d)
|
sync.Reset(d)
|
||||||
|
|
||||||
if err := c.SyncServices(); err != nil {
|
if err := c.SyncServices(); err != nil {
|
||||||
|
|
Loading…
Reference in New Issue