From eb714d8ae31afb9bceb5c3b77006715e820340c8 Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Tue, 27 Mar 2018 15:12:39 -0400 Subject: [PATCH] FIX: application request count keys not expiring in redis --- app/models/concerns/cached_counting.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/concerns/cached_counting.rb b/app/models/concerns/cached_counting.rb index 8f629df70e8..867c8fb250e 100644 --- a/app/models/concerns/cached_counting.rb +++ b/app/models/concerns/cached_counting.rb @@ -50,7 +50,9 @@ module CachedCounting # for concurrent calls without double counting def get_and_reset(key) namespaced_key = $redis.namespace_key(key) - $redis.without_namespace.eval(GET_AND_RESET, keys: [namespaced_key]).to_i + val = $redis.without_namespace.eval(GET_AND_RESET, keys: [namespaced_key]).to_i + $redis.expire(key, 259200) # SET removes expiry, so set it again + val end def request_id(query_params, retries = 0)