From f0dbe185e00b67b79075047518afeecfb732b763 Mon Sep 17 00:00:00 2001 From: Leo Antunes Date: Mon, 4 Apr 2022 17:44:56 +0200 Subject: [PATCH] feat: do not count context cancelation as peer error --- groupcache.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/groupcache.go b/groupcache.go index 915e265..4815437 100644 --- a/groupcache.go +++ b/groupcache.go @@ -386,6 +386,9 @@ func (g *Group) load(ctx context.Context, key string, dest Sink) (value ByteView if err == nil { g.Stats.PeerLoads.Add(1) return value, nil + } else if errors.Is(err, context.Canceled) { + // do not count context cancellation as a peer error + return nil, err } if logger != nil {