From 7776e35c877e2ee344f858dbd3c46d58543a2b16 Mon Sep 17 00:00:00 2001 From: Nick LaMuro Date: Tue, 15 Aug 2017 15:29:12 -0500 Subject: [PATCH] Have run_single_worker.rb setup signal traps Instead of the run_single_worker.rb script calling `.start_worker` on the Runner class, have it instantiate a new class, call `#setup_sigterm_trap` on that instance, and then call start (effectively `start_worker`, just adds the `#setup_sigterm_trap` call in the middle) --- lib/workers/bin/run_single_worker.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/workers/bin/run_single_worker.rb b/lib/workers/bin/run_single_worker.rb index 36d1808253d..db25e8041b3 100644 --- a/lib/workers/bin/run_single_worker.rb +++ b/lib/workers/bin/run_single_worker.rb @@ -72,7 +72,8 @@ end begin - worker.class::Runner.start_worker(runner_options.merge(:guid => worker.guid)) + runner_options[:guid] = worker.guid + worker.class::Runner.new(runner_options).tap(&:setup_sigterm_trap).start ensure worker.delete end