Avoid hardcoded value in `unicorn_launcher`.

On slower instances, spinning up a new master process
can take more than 10 secs.
This commit is contained in:
Guo Xiang Tan 2018-10-04 15:43:25 +08:00
parent 378584fdc0
commit 09d0216e84
1 changed files with 7 additions and 2 deletions

View File

@ -15,9 +15,14 @@ function on_reload()
{
echo "Reloading unicorn"
kill -s USR2 $UNICORN_PID
sleep 10
while [ -z "$NEW_UNICORN_PID" ]; do
echo "waiting for new unicorn master pid"
NEW_UNICORN_PID=`ps -f --ppid $UNICORN_PID | grep 'unicorn master' | grep -v worker | awk '{ print $2 }'`
sleep 1
done
curl $LOCAL_WEB &> /dev/null
NEW_UNICORN_PID=`ps -f --ppid $UNICORN_PID | grep unicorn | grep -v worker | awk '{ print $2 }'`
kill -s QUIT $UNICORN_PID
echo "Old pid is: $UNICORN_PID New pid is: $NEW_UNICORN_PID"
UNICORN_PID=$NEW_UNICORN_PID