Skip to content

Commit

Permalink
Merge pull request moby#39513 from cpuguy83/libcontainerd_events_wait
Browse files Browse the repository at this point in the history
Sleep before restarting event processing
  • Loading branch information
crosbymichael authored Jul 15, 2019
2 parents f511101 + 1acaf2a commit 3ce2379
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions libcontainerd/remote/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -703,10 +703,16 @@ func (c *client) processEventStream(ctx context.Context, ns string) {
errStatus, ok := status.FromError(err)
if !ok || errStatus.Code() != codes.Canceled {
c.logger.WithError(err).Error("failed to get event")
go c.processEventStream(ctx, ns)
} else {
c.logger.WithError(ctx.Err()).Info("stopping event stream following graceful shutdown")

// rate limit
select {
case <-time.After(time.Second):
go c.processEventStream(ctx, ns)
return
case <-ctx.Done():
}
}
c.logger.WithError(ctx.Err()).Info("stopping event stream following graceful shutdown")
}
return
case ev = <-eventStream:
Expand Down

0 comments on commit 3ce2379

Please sign in to comment.