diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 17:34:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 17:34:42 +0300 |
commit | 9f46488805e86b1bc341ea1620b866016c2ce5ed (patch) | |
tree | f9748c7e287041e37d6da49e0a29c9511dc34768 /config/initializers_before_autoloader | |
parent | dfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff) |
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'config/initializers_before_autoloader')
-rw-r--r-- | config/initializers_before_autoloader/002_sidekiq.rb | 20 | ||||
-rw-r--r-- | config/initializers_before_autoloader/100_patch_omniauth_oauth2.rb | 17 |
2 files changed, 37 insertions, 0 deletions
diff --git a/config/initializers_before_autoloader/002_sidekiq.rb b/config/initializers_before_autoloader/002_sidekiq.rb new file mode 100644 index 00000000000..4ce9127a45d --- /dev/null +++ b/config/initializers_before_autoloader/002_sidekiq.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +# Preloads Sidekiq configurations that don't require application references. +# +# It ensures default settings are loaded before any other file references +# (directly or indirectly) Sidekiq workers. +# + +require 'sidekiq/web' + +# Disable the Sidekiq Rack session since GitLab already has its own session store. +# CSRF protection still works (https://github.com/mperham/sidekiq/commit/315504e766c4fd88a29b7772169060afc4c40329). +Sidekiq::Web.set :sessions, false + +# Default is to retry 25 times with exponential backoff. That's too much. +Sidekiq.default_worker_options = { retry: 3 } + +if Rails.env.development? + Sidekiq.default_worker_options[:backtrace] = true +end diff --git a/config/initializers_before_autoloader/100_patch_omniauth_oauth2.rb b/config/initializers_before_autoloader/100_patch_omniauth_oauth2.rb new file mode 100644 index 00000000000..760fcba5935 --- /dev/null +++ b/config/initializers_before_autoloader/100_patch_omniauth_oauth2.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module OmniAuth + module Strategies + class OAuth2 + alias_method :original_callback_phase, :callback_phase + + # Monkey patch until PR is merged and released upstream + # https://github.com/omniauth/omniauth-oauth2/pull/129 + def callback_phase + original_callback_phase + rescue ::Faraday::TimeoutError, ::Faraday::ConnectionFailed => e + fail!(:timeout, e) + end + end + end +end |