From 6b745964c4ce78352e56debf302354b209dd0507 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 4 Jun 2018 13:39:57 -0700 Subject: [PATCH] agent/cache: update comment from PR review to clarify --- agent/cache/cache.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/agent/cache/cache.go b/agent/cache/cache.go index 54f2707e63..797f00697f 100644 --- a/agent/cache/cache.go +++ b/agent/cache/cache.go @@ -367,7 +367,11 @@ func (c *Cache) fetch(t, key string, r Request, allowNew bool, attempt uint) (<- // Increment attempt counter attempt++ - // Set the error that should be used if the fetch is failing. + // Always set the error. We don't override the value here because + // if Valid is true, then we can reuse the Value in the case a + // specific index isn't requested. However, for blocking queries, + // we want Error to be set so that we can return early with the + // error. newEntry.Error = err }