Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions manager/dispatcher/dispatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,16 @@ func (d *Dispatcher) Run(ctx context.Context) error {
publishManagers(ev.([]*api.Peer))
case <-d.processUpdatesTrigger:
d.processUpdates(ctx)
batchTimer.Stop()
// drain the timer, if it has already expired
select {
case <-batchTimer.C:
default:
}
batchTimer.Reset(maxBatchInterval)
case <-batchTimer.C:
d.processUpdates(ctx)
// batch timer has already expired, so no need to drain
batchTimer.Reset(maxBatchInterval)
case v := <-configWatcher:
cluster := v.(api.EventUpdateCluster)
Expand Down
5 changes: 5 additions & 0 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -1136,6 +1136,11 @@ func (n *Node) superviseManager(ctx context.Context, securityConfig *ca.Security
// re-promoted. In this case, we must assume we were
// re-promoted, and restart the manager.
log.G(ctx).Warn("failed to get worker role after manager stop, forcing certificate renewal")

// We can safely reset this timer without stopping/draining the timer
// first because the only way the code has reached this point is if the timer
// has already expired - if the role changed or the context were canceled,
// then we would have returned already.
timer.Reset(roleChangeTimeout)

renewer.Renew()
Expand Down