Skip to content

Commit

Permalink
Log: debug user cancellation and log warning for rest
Browse files Browse the repository at this point in the history
The context error with cancel code is typically for user cancellation which
should be at debug level. For other error codes we should display a warning.

Fixes etcd-io#9085
  • Loading branch information
spzala committed Jan 5, 2018
1 parent 2fb9728 commit 4293f21
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion etcdserver/api/v3rpc/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,11 @@ func (ws *watchServer) Watch(stream pb.Watch_WatchServer) (err error) {
// deadlock when calling sws.close().
go func() {
if rerr := sws.recvLoop(); rerr != nil {
plog.Debugf("failed to receive watch request from gRPC stream (%q)", rerr.Error())
if stream.Context().Err() == context.Canceled {
plog.Debugf("failed to receive watch request from gRPC stream 11 (%q)", rerr.Error())
} else {
plog.Warningf("failed to receive watch request from gRPC stream (%q)", rerr.Error())
}
errc <- rerr
}
}()
Expand Down

0 comments on commit 4293f21

Please sign in to comment.