Commit 66d049bc authored by Igor Wiedler's avatar Igor Wiedler

Perform redis UNLINK instead of DEL in ElasticsearchEnabledCache

parent e0f9392f
...@@ -55,7 +55,9 @@ module Gitlab ...@@ -55,7 +55,9 @@ module Gitlab
# #
# @param type [Symbol] the type of resource, `:project` or `:namespace` # @param type [Symbol] the type of resource, `:project` or `:namespace`
def delete(type) def delete(type)
Gitlab::Redis::Cache.with { |redis| redis.del(redis_key(type)) } Gitlab::Redis::Cache.with do |redis|
unlink_or_delete(redis, redis_key(type))
end
end end
private private
...@@ -63,6 +65,13 @@ module Gitlab ...@@ -63,6 +65,13 @@ module Gitlab
def redis_key(type) def redis_key(type)
"elasticsearch_enabled_cache:#{type}" "elasticsearch_enabled_cache:#{type}"
end end
def unlink_or_delete(redis, key)
redis.unlink(key)
rescue ::Redis::CommandError => e
Gitlab::ErrorTracking.log_exception(e)
redis.del(key)
end
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment