Index: common/clock/clockcontext.go |
diff --git a/common/clock/clockcontext.go b/common/clock/clockcontext.go |
index 979f2fc0588d02a29fc808553ff43742c9dbb640..1b9df12e35e83e0a6be23c9ece273f3e7f04fafd 100644 |
--- a/common/clock/clockcontext.go |
+++ b/common/clock/clockcontext.go |
@@ -71,11 +71,8 @@ func WithDeadline(parent context.Context, deadline time.Time) (context.Context, |
// Invoke our cancelFunc after the specified time. |
go func() { |
- select { |
- case <-c.Done(): |
- break |
- |
- case <-After(c, d): |
+ if ar := <-After(c, d); ar.Err == nil { |
+ // Timer expired naturally. |
c.setError(context.DeadlineExceeded) |
cancelFunc() |
} |