Skip to content

Commit

Permalink
Customize cache traces
Browse files Browse the repository at this point in the history
  • Loading branch information
obourdon committed Nov 25, 2020
1 parent d5c70a9 commit 77cf592
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,15 @@ func (h healthHandler) processAndEnsureCached(negotiatedContentType string, outp
cacheKey := fmt.Sprintf("res:%s", negotiatedContentType)
tmp, found := h.cache.Get(cacheKey)
if found {
log.Printf("[TRACE] Returning cached[%s] (1).", cacheKey)
return tmp.(res)
}

h.gossMu.Lock()
defer h.gossMu.Unlock()
tmp, found = h.cache.Get(cacheKey)
if found {
log.Printf("[TRACE] Returning cached[%s].", cacheKey)
log.Printf("[TRACE] Returning cached[%s] (2).", cacheKey)
return tmp.(res)
}

Expand Down

0 comments on commit 77cf592

Please sign in to comment.