summaryrefslogtreecommitdiff
path: root/config/application.rb
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2017-08-24 14:35:21 +0200
committerYorick Peterse <yorickpeterse@gmail.com>2017-08-24 20:22:16 +0200
commit167b9b81440017f5253efda4bb6566d12f0eedc8 (patch)
treeeadc56ab63940fbaa6abbd9d3267b983c0adaf4b /config/application.rb
parentc8406ec3bf57acbaee8413772091ffc5ee9a30fb (diff)
downloadgitlab-ce-schema-cache.tar.gz
Enable caching of schema.rbschema-cache
This is a lesser known Rails feature that removes the need for querying various internal tables for schema details (e.g. column types) every time Rails boots up. This feature is described in http://iempire.ru/2016/12/13/schema-cache/ and was brought to our attention by @stanhu. Since the schema cache is specific to the database we only enable this on PostgreSQL.
Diffstat (limited to 'config/application.rb')
-rw-r--r--config/application.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/config/application.rb b/config/application.rb
index f69dab4de39..68dc449b793 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -10,6 +10,7 @@ module Gitlab
require_dependency Rails.root.join('lib/gitlab/redis/queues')
require_dependency Rails.root.join('lib/gitlab/redis/shared_state')
require_dependency Rails.root.join('lib/gitlab/request_context')
+ require_dependency Rails.root.join('lib/gitlab/database')
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
@@ -156,6 +157,10 @@ module Gitlab
config.active_record.raise_in_transactional_callbacks = true
+ # The schema cache is database specific. There is no way to support both
+ # PostgreSQL and MySQL, hence we only enable this when PostgreSQL is used.
+ config.active_record.use_schema_cache_dump = Gitlab::Database.postgresql?
+
config.active_job.queue_adapter = :sidekiq
# This is needed for gitlab-shell