Merge pull request #361 from thaJeztah/19.03_backport_libcontainerd_events_wait
[19.03 backport] Sleep before restarting event processing
This commit is contained in:
commit
f4f8feafe7
1 changed files with 9 additions and 3 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue