Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2014-11-28 17:19:03 +0300
committerJacob Vosmaer <contact@jacobvosmaer.nl>2014-11-28 17:19:03 +0300
commitd336127a20ce22a9512123595a887c4207b748e9 (patch)
treebe467775cad2702a548b5c1e636526f8568feca2 /lib
parent64ab6c9ed54d1c0a86f4c3bb6b87fcac882da0c0 (diff)
Add comments to the MemoryKiller middleware
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/sidekiq_middleware/memory_killer.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/gitlab/sidekiq_middleware/memory_killer.rb b/lib/gitlab/sidekiq_middleware/memory_killer.rb
index 3ef46627916..0fb09d3f228 100644
--- a/lib/gitlab/sidekiq_middleware/memory_killer.rb
+++ b/lib/gitlab/sidekiq_middleware/memory_killer.rb
@@ -12,10 +12,13 @@ module Gitlab
Sidekiq.logger.warn "current RSS #{current_rss} exceeds maximum RSS "\
"#{max_rss}"
Sidekiq.logger.warn "sending SIGUSR1 to PID #{Process.pid}"
+ # SIGUSR1 tells Sidekiq to stop accepting new jobs
Process.kill('SIGUSR1', Process.pid)
Sidekiq.logger.warn "spawning thread that will send SIGTERM to PID "\
"#{Process.pid} in #{graceful_shutdown_wait} seconds"
+ # Send the final shutdown signal to Sidekiq from a separate thread so
+ # that the current job can finish
Thread.new do
sleep(graceful_shutdown_wait)
Process.kill('SIGTERM', Process.pid)