Skip to content

Commit

Permalink
WIP - Wait in work loop rather than sleeping
Browse files Browse the repository at this point in the history
Prevents work from getting added out of order, and increases the chances
that the current leader gets further ahead.
  • Loading branch information
smarterclayton committed Apr 19, 2018
1 parent ef95391 commit ab5e947
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions pkg/router/controller/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ func performIngressConditionUpdate(action string, lease writerlease.Lease, track

switch _, err := oc.Routes(route.Namespace).UpdateStatus(route); {
case err == nil:
glog.V(4).Infof("%s: updated status of %s/%s", action, route.Namespace, route.Name)
tracker.Clear(key, latest)
return writerlease.Extend, false
case errors.IsForbidden(err):
Expand Down
3 changes: 2 additions & 1 deletion pkg/util/writerlease/writerlease.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,8 @@ func (l *WriterLease) work() bool {
// if we are following, continue to defer work until the lease expires
if remaining := leaseExpires.Sub(l.nowFn()); remaining > 0 {
glog.V(4).Infof("[%s] Follower, %s remaining in lease", l.name, remaining)
l.queue.AddAfter(key, remaining)
time.Sleep(remaining)
l.queue.Add(key)
l.queue.Done(key)
return true
}
Expand Down

0 comments on commit ab5e947

Please sign in to comment.