diff options
author | Kamil TrzciĆski <ayufan@ayufan.eu> | 2019-08-14 17:56:37 +0200 |
---|---|---|
committer | Qingyu Zhao <qzhao@gitlab.com> | 2019-08-21 18:50:46 +1000 |
commit | 75e2302d0126c4bc8ea215ffb4e72612d44e73bb (patch) | |
tree | 9b7bb2eb248080aab20cd8de15cf73ceb8b97dd8 /config/initializers/sidekiq.rb | |
parent | ca622a3e13cf88d94c6b3c98554e9782d37d4ad5 (diff) | |
download | gitlab-ce-75e2302d0126c4bc8ea215ffb4e72612d44e73bb.tar.gz |
Allow to interrupt running jobs
This adds a middleware to track all threads
for running jobs.
This makes sidekiq to watch for redis-delivered notifications.
This makes be able to send notification to interrupt
running sidekiq jobs.
This does not take into account any native code,
as `Thread.raise` generates exception once the control gets
back to Ruby.
The separate measure should be taken to interrupt gRPC, shellouts,
or anything else that escapes Ruby.
Diffstat (limited to 'config/initializers/sidekiq.rb')
-rw-r--r-- | config/initializers/sidekiq.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb index 7217f098fd9..b05d4342e23 100644 --- a/config/initializers/sidekiq.rb +++ b/config/initializers/sidekiq.rb @@ -33,6 +33,7 @@ Sidekiq.configure_server do |config| config.redis = queues_config_hash config.server_middleware do |chain| + chain.add Gitlab::SidekiqMiddleware::JobsThreads unless ENV['DISABLE_SIDEKIQ_INTERRUPT_RUNNING_JOBS'] 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 +58,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::SidekiqStatus::Monitor.instance.start unless ENV['DISABLE_SIDEKIQ_INTERRUPT_RUNNING_JOBS'] end if enable_reliable_fetch? |