From d336127a20ce22a9512123595a887c4207b748e9 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer <contact@jacobvosmaer.nl> Date: Fri, 28 Nov 2014 15:19:03 +0100 Subject: [PATCH] Add comments to the MemoryKiller middleware --- lib/gitlab/sidekiq_middleware/memory_killer.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/gitlab/sidekiq_middleware/memory_killer.rb b/lib/gitlab/sidekiq_middleware/memory_killer.rb index 3ef4662791..0fb09d3f22 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) -- 2.30.9