diff options
author | Stan Hu <stanhu@gmail.com> | 2016-04-05 09:43:48 -0700 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-05-03 15:50:09 +0200 |
commit | 073e808ecfc658333132a1a4faf69575224f02fc (patch) | |
tree | cb3a5a856daa65cfc38dfc37398b59afe96d6a6c | |
parent | f0c4f727359a5848d12e2097bad6a6a3190943ef (diff) | |
download | gitlab-ce-073e808ecfc658333132a1a4faf69575224f02fc.tar.gz |
Add eager load paths to help prevent dependency load issues with Sidekiq workers
Attempts to address #13521, #14825
Signed-off-by: Rémy Coutable <remy@rymai.me>
-rw-r--r-- | CHANGELOG | 2 | ||||
-rw-r--r-- | config/application.rb | 19 |
2 files changed, 15 insertions, 6 deletions
diff --git a/CHANGELOG b/CHANGELOG index b6527780bbf..5c3c9efefdb 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -60,6 +60,8 @@ v 8.7.0 - Fix `signed_in_ip` being set to 127.0.0.1 when using a reverse proxy !3524 - Improved Markdown rendering performance !3389 - Make shared runners text in box configurable + - Add eager load paths to help prevent dependency load issues with Sidekiq workers (Stan Hu) + - Improved Markdown rendering performance !3389 (Yorick Peterse) - Don't attempt to look up an avatar in repo if repo directory does not exist (Stan Hu) - API: Ability to subscribe and unsubscribe from issues and merge requests (Robert Schilling) - Expose project badges in project settings diff --git a/config/application.rb b/config/application.rb index b602e2b6168..b33e57f5fcd 100644 --- a/config/application.rb +++ b/config/application.rb @@ -12,12 +12,19 @@ module Gitlab # Application configuration should go into files in config/initializers # -- all .rb files in that directory are automatically loaded. - # Custom directories with classes and modules you want to be autoloadable. - config.autoload_paths.push(*%W(#{config.root}/lib - #{config.root}/app/models/hooks - #{config.root}/app/models/concerns - #{config.root}/app/models/project_services - #{config.root}/app/models/members)) + # Sidekiq uses eager loading, but directories not in the standard Rails + # directories must be added to the eager load paths: + # https://github.com/mperham/sidekiq/wiki/FAQ#why-doesnt-sidekiq-autoload-my-rails-application-code + # Also, there is no need to add `lib` to autoload_paths since autoloading is + # configured to check for eager loaded paths: + # https://github.com/rails/rails/blob/v4.2.6/railties/lib/rails/engine.rb#L687 + # This is a nice reference article on autoloading/eager loading: + # http://blog.arkency.com/2014/11/dont-forget-about-eager-load-when-extending-autoload + config.eager_load_paths.push(*%W(#{config.root}/lib + #{config.root}/app/models/hooks + #{config.root}/app/models/concerns + #{config.root}/app/models/project_services + #{config.root}/app/models/members)) # Only load the plugins named here, in the order given (default is alphabetical). # :all can be used as a placeholder for all plugins not explicitly named. |