Skip to content

A platform for community discussion. Free, open, simple.

FIX: application request count keys not expiring in redis

Neil Lalondeeb714d8ae31a
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)