Skip to content

Commit bb03967

Browse files
authored
Merge pull request #23 from ibuildthecloud/master
Only log error if we are closing a watch in response to an error
2 parents 1543f85 + a15242d commit bb03967

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pkg/server/watch.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,14 @@ func (w *watcher) Cancel(watchID int64, err error) {
131131
reason = err.Error()
132132
}
133133
logrus.Debugf("WATCH CANCEL id=%d reason=%s", watchID, reason)
134-
err = w.server.Send(&etcdserverpb.WatchResponse{
134+
serr := w.server.Send(&etcdserverpb.WatchResponse{
135135
Header: &etcdserverpb.ResponseHeader{},
136136
Canceled: true,
137137
CancelReason: "watch closed",
138138
WatchId: watchID,
139139
})
140-
if err != nil {
141-
logrus.Errorf("WATCH Failed to send cancel response for watchID %d: %v", watchID, err)
140+
if serr != nil && err != nil {
141+
logrus.Errorf("WATCH Failed to send cancel response for watchID %d: %v", watchID, serr)
142142
}
143143
}
144144

0 commit comments

Comments
 (0)