Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Brian Goff authored on 2017/11/15 07:00:47... | ... |
@@ -17,6 +17,8 @@ import ( |
17 | 17 |
"github.com/sirupsen/logrus" |
18 | 18 |
"golang.org/x/net/context" |
19 | 19 |
"google.golang.org/grpc" |
20 |
+ "google.golang.org/grpc/codes" |
|
21 |
+ "google.golang.org/grpc/status" |
|
20 | 22 |
) |
21 | 23 |
|
22 | 24 |
// nodeRunner implements a manager for continuously running swarmkit node, restarting them with backoff delays if needed. |
... | ... |
@@ -217,7 +219,10 @@ func (n *nodeRunner) watchClusterEvents(ctx context.Context, conn *grpc.ClientCo |
217 | 217 |
msg, err := watch.Recv() |
218 | 218 |
if err != nil { |
219 | 219 |
// store watch is broken |
220 |
- logrus.WithError(err).Error("failed to receive changes from store watch API") |
|
220 |
+ errStatus, ok := status.FromError(err) |
|
221 |
+ if !ok || errStatus.Code() != codes.Canceled { |
|
222 |
+ logrus.WithError(err).Error("failed to receive changes from store watch API") |
|
223 |
+ } |
|
221 | 224 |
return |
222 | 225 |
} |
223 | 226 |
select { |
... | ... |
@@ -17,6 +17,8 @@ import ( |
17 | 17 |
"time" |
18 | 18 |
|
19 | 19 |
"google.golang.org/grpc" |
20 |
+ "google.golang.org/grpc/codes" |
|
21 |
+ "google.golang.org/grpc/status" |
|
20 | 22 |
|
21 | 23 |
"github.com/containerd/containerd" |
22 | 24 |
eventsapi "github.com/containerd/containerd/api/services/events/v1" |
... | ... |
@@ -687,7 +689,10 @@ func (c *client) processEventStream(ctx context.Context) { |
687 | 687 |
for { |
688 | 688 |
ev, err = eventStream.Recv() |
689 | 689 |
if err != nil { |
690 |
- c.logger.WithError(err).Error("failed to get event") |
|
690 |
+ errStatus, ok := status.FromError(err) |
|
691 |
+ if !ok || errStatus.Code() != codes.Canceled { |
|
692 |
+ c.logger.WithError(err).Error("failed to get event") |
|
693 |
+ } |
|
691 | 694 |
return |
692 | 695 |
} |
693 | 696 |
|