Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Merge pull request #937 from bcwaldon/rem-ttl
Browse files Browse the repository at this point in the history
engine: set TTL based on obsolete lease
  • Loading branch information
bcwaldon committed Oct 2, 2014
2 parents f010db9 + 66ba5d7 commit fd2ceeb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions engine/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ func acquireLeadership(lReg registry.LeaseRegistry, machID string, ver int, ttl
return nil
}

l, err = lReg.StealLease(engineLeaseName, machID, ver, ttl, existing.Index())
rem := existing.TimeRemaining()
l, err = lReg.StealLease(engineLeaseName, machID, ver, ttl+rem, existing.Index())
if err != nil {
log.Errorf("Engine leadership steal failed: %v", err)
return nil
Expand All @@ -166,7 +167,6 @@ func acquireLeadership(lReg registry.LeaseRegistry, machID string, ver int, ttl

log.Infof("Stole engine leadership from Machine(%s)", existing.MachineID())

rem := existing.TimeRemaining()
if rem > 0 {
log.Infof("Waiting %v for previous lease to expire before continuing reconciliation", rem)
<-time.After(rem)
Expand Down

0 comments on commit fd2ceeb

Please sign in to comment.