diff options
author | Stan Hu <stanhu@gmail.com> | 2019-08-21 21:37:36 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-08-21 21:37:36 +0300 |
commit | 9a0c1f64f540c1f07b2742a4c1c3ef4bee749bfd (patch) | |
tree | f85db52685bc95983c23d470b3443f8ac79fa848 /config | |
parent | 5fb18d5766a198882e35dbbb332c8eee85320a61 (diff) | |
parent | 8d17c4dae6b4662dddffe9e2ddca8100e8cd3d0b (diff) |
Merge branch 'sidekiq-interrupt-running-jobs' into 'master'
Allow to interrupt running sidekiq jobs
See merge request gitlab-org/gitlab-ce!31818
Diffstat (limited to 'config')
-rw-r--r-- | config/initializers/sidekiq.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb index 7217f098fd9..9f3e104bc2b 100644 --- a/config/initializers/sidekiq.rb +++ b/config/initializers/sidekiq.rb @@ -28,11 +28,13 @@ if Rails.env.development? end enable_json_logs = Gitlab.config.sidekiq.log_format == 'json' +enable_sidekiq_monitor = ENV.fetch("SIDEKIQ_MONITOR_WORKER", 0).to_i.nonzero? Sidekiq.configure_server do |config| config.redis = queues_config_hash config.server_middleware do |chain| + chain.add Gitlab::SidekiqMiddleware::Monitor if enable_sidekiq_monitor chain.add Gitlab::SidekiqMiddleware::Metrics if Settings.monitoring.sidekiq_exporter chain.add Gitlab::SidekiqMiddleware::ArgumentsLogger if ENV['SIDEKIQ_LOG_ARGUMENTS'] && !enable_json_logs chain.add Gitlab::SidekiqMiddleware::MemoryKiller if ENV['SIDEKIQ_MEMORY_KILLER_MAX_RSS'] @@ -57,6 +59,8 @@ Sidekiq.configure_server do |config| # Clear any connections that might have been obtained before starting # Sidekiq (e.g. in an initializer). ActiveRecord::Base.clear_all_connections! + + Gitlab::SidekiqMonitor.instance.start if enable_sidekiq_monitor end if enable_reliable_fetch? |