From 86d14785007b71fac318b94109e4536ae3faa68a Mon Sep 17 00:00:00 2001 From: Ben Ye Date: Mon, 5 Oct 2020 17:31:11 -0400 Subject: [PATCH] add back fix for #3240 Signed-off-by: Ben Ye --- cmd/thanos/query_frontend.go | 5 ++++- pkg/queryfrontend/config.go | 5 ----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/cmd/thanos/query_frontend.go b/cmd/thanos/query_frontend.go index bc3c0f1b20..5ac7342bf8 100644 --- a/cmd/thanos/query_frontend.go +++ b/cmd/thanos/query_frontend.go @@ -106,7 +106,10 @@ func runQueryFrontend( if err != nil { return errors.Wrap(err, "initializing the query frontend config") } - + if cfg.CortexResultsCacheConfig.CacheConfig.Memcache.Expiration == 0 { + level.Warn(logger).Log("msg", "memcached cache valid time set to 0, so using a default of 24 hours expiration time") + cfg.CortexResultsCacheConfig.CacheConfig.Memcache.Expiration = 24 * time.Hour + } cfg.CortexResultsCacheConfig = &queryrange.ResultsCacheConfig{ Compression: cfg.CacheCompression, CacheConfig: *cacheConfig, diff --git a/pkg/queryfrontend/config.go b/pkg/queryfrontend/config.go index b2b9e77ecf..3df378e76a 100644 --- a/pkg/queryfrontend/config.go +++ b/pkg/queryfrontend/config.go @@ -88,11 +88,6 @@ func NewCacheConfig(logger log.Logger, confContentYaml []byte) (*cortexcache.Con level.Warn(logger).Log("message", "MaxItemSize is not yet supported by the memcached client") } - if config.Expiration == 0 { - level.Warn(logger).Log("msg", "memcached cache valid time set to 0, so using a default of 24 hours expiration time") - config.Expiration = 24 * time.Hour - } - return &cortexcache.Config{ Memcache: cortexcache.MemcachedConfig{ Expiration: config.Expiration,