Stop Sidekiq first before reloading unicorn master

Stop Sidekiq first before reloading unicorn master.

From 598ac69773101bf791ad9fee8b648c43f570a3f0 Mon Sep 17 00:00:00 2001
From: Guo Xiang Tan <tgx_world@hotmail.com>
Date: Wed, 21 Nov 2018 09:52:36 +0800
Subject: [PATCH] Stop Sidekiq first before reloading unicorn master.


diff --git a/config/unicorn_launcher b/config/unicorn_launcher
index 0aec686..39604fd 100755
--- a/config/unicorn_launcher
+++ b/config/unicorn_launcher
@@ -18,6 +18,8 @@ function on_exit()
 
 function on_reload()
 {
+  log "Stopping Sidekiq"
+  kill -s TSTP $UNICORN_PID
   log "Reloading unicorn ($UNICORN_PID)"
   kill -s USR2 $UNICORN_PID
   unset NEW_UNICORN_PID

GitHub

This commit has been mentioned on Discourse Meta. There might be relevant details there:

interesting, I wonder if we should hook into USR2 handling in unicorn and handle this directly there, then we can also tell Demon not to try reloading it and so on.

We could prepend a module I guess, or maybe get Eric to add a callback.

Maybe it is worth posting to the unicorn mailing list asking Eric if there is a cleaner way to do Demon stuff, maybe unicorn should provide the facility?