Commit 7dc0c5fd authored by Stan Hu's avatar Stan Hu Committed by Bob Van Landuyt

Use Rails 5.2 Redis caching store

In GitLab v12.2.0, we enabled the Rails Redis caching store in
production
(https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/30966). However,
we had to to revert this in 6bda359b
because Rack Attack v4.4.1 wasn't fully compatible with this store and
caused fatal errors when rate limits were enabled
(https://github.com/kickstarter/rack-attack/issues/281).

Now that we have upgraded to Rack Attack v6.2.0, which pulls in
https://github.com/kickstarter/rack-attack/pull/340, this caching store
is now supported. This is validated by the GitLab QA tests introduced
in https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/32177.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/64794
parent 01fd6f35
---
title: Use Rails 5.2 Redis caching store
merge_request: 19202
author:
type: other
......@@ -247,7 +247,10 @@ module Gitlab
end
# Use caching across all environments
# Full list of options:
# https://api.rubyonrails.org/classes/ActiveSupport/Cache/RedisCacheStore.html#method-c-new
caching_config_hash = Gitlab::Redis::Cache.params
caching_config_hash[:compress] = false
caching_config_hash[:namespace] = Gitlab::Redis::Cache::CACHE_NAMESPACE
caching_config_hash[:expires_in] = 2.weeks # Cache should not grow forever
if Sidekiq.server? # threaded context
......@@ -255,7 +258,7 @@ module Gitlab
caching_config_hash[:pool_timeout] = 1
end
config.cache_store = :redis_store, caching_config_hash
config.cache_store = :redis_cache_store, caching_config_hash
config.active_job.queue_adapter = :sidekiq
......
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