fix error

This commit is contained in:
chiu 2021-08-23 18:24:43 +08:00
parent 3bb22a8853
commit e2154d3946
1 changed files with 2 additions and 4 deletions

View File

@ -22,9 +22,7 @@ class Admin::RulingBusesController < OrbitAdminController
@ruling_bus_setting = RulingBusSetting.find(params[:id])
@ruling_bus_setting.update_attributes(ruling_bus_setting_params)
Thread.new do
sleep 3
mode = Rails.env
content = "UNICORN_PID=\"`fuser tmp/pids/unicorn.sock tmp/sockets/unicorn.sock tmp/unicorn.sock` `cat tmp/pids/unicorn.pid `\" && kill -s TERM $UNICORN_PID ; while (kill -0 $UNICORN_PID > /dev/null 2>&1) ; do printf '.' && sleep 1 ; done ; unset UNICORN_FD; bundle exec unicorn_rails -c config/unicorn.rb -D -E #{mode}"
content = "UNICORN_PID=\"`fuser tmp/pids/unicorn.sock tmp/sockets/unicorn.sock tmp/unicorn.sock` `cat tmp/pids/unicorn.pid `\" && kill -s USR2 $UNICORN_PID ; n=20; while (kill -0 $UNICORN_PID > /dev/null 2>&1) && test $n -ge 0; do printf '.' && sleep 1 && n=$(( $n - 1 )); done ; if test $n -lt 0; then kill -s TERM $UNICORN_PID; sleep 3; bundle exec unicorn_rails -c config/unicorn.rb -D -E #{Rails.env}; else kill -s QUIT $UNICORN_PID; fi"
system(content)
end
redirect_to (params[:referer_url].blank? ? "/#{I18n.locale}/admin/ruling_buses": params[:referer_url])