fixing rubocop issues
This commit is contained in:
parent
04e2d8ccc7
commit
4752384df0
2 changed files with 9 additions and 18 deletions
1
Gemfile
1
Gemfile
|
@ -117,7 +117,6 @@ end
|
||||||
gem 'puma', group: :puma
|
gem 'puma', group: :puma
|
||||||
gem 'unicorn', group: :unicorn
|
gem 'unicorn', group: :unicorn
|
||||||
|
|
||||||
|
|
||||||
# load onw gem's
|
# load onw gem's
|
||||||
local_gemfile = File.join(File.dirname(__FILE__), 'Gemfile.local')
|
local_gemfile = File.join(File.dirname(__FILE__), 'Gemfile.local')
|
||||||
if File.exist?(local_gemfile)
|
if File.exist?(local_gemfile)
|
||||||
|
|
|
@ -1,18 +1,10 @@
|
||||||
APP_DIR="."
|
worker_processes 4
|
||||||
UNICORN_DIR="#{APP_DIR}"
|
timeout 30
|
||||||
UNICORN_WORKER="4"
|
stderr_path 'log/unicorn_error.log'
|
||||||
UNICORN_TIMEOUT="30"
|
stdout_path 'log/unicorn_access.log'
|
||||||
RAILS_PID_DIR="#{APP_DIR}/tmp/pids"
|
pid 'tmp/pids/unicorn.pid'
|
||||||
RAILS_LOG_DIR="#{APP_DIR}/log"
|
|
||||||
|
|
||||||
worker_processes UNICORN_WORKER.to_i
|
before_fork do |server, _worker|
|
||||||
working_directory UNICORN_DIR
|
|
||||||
timeout UNICORN_TIMEOUT.to_i
|
|
||||||
pid "#{RAILS_PID_DIR}/unicorn.pid"
|
|
||||||
stderr_path "#{RAILS_LOG_DIR}/unicorn_error.log"
|
|
||||||
stdout_path "#{RAILS_LOG_DIR}/unicorn_access.log"
|
|
||||||
|
|
||||||
before_fork do |server, worker|
|
|
||||||
##
|
##
|
||||||
# When sent a USR2, Unicorn will suffix its pidfile with .oldbin and
|
# When sent a USR2, Unicorn will suffix its pidfile with .oldbin and
|
||||||
# immediately start loading up a new version of itself (loaded with a new
|
# immediately start loading up a new version of itself (loaded with a new
|
||||||
|
@ -25,11 +17,11 @@ before_fork do |server, worker|
|
||||||
# Using this method we get 0 downtime deploys.
|
# Using this method we get 0 downtime deploys.
|
||||||
|
|
||||||
old_pid = "#{RAILS_PID_DIR}/unicorn.pid.oldbin"
|
old_pid = "#{RAILS_PID_DIR}/unicorn.pid.oldbin"
|
||||||
if File.exists?(old_pid) && server.pid != old_pid
|
if File.exist?(old_pid) && server.pid != old_pid
|
||||||
begin
|
begin
|
||||||
Process.kill("QUIT", File.read(old_pid).to_i)
|
Process.kill('QUIT', File.read(old_pid).to_i)
|
||||||
rescue Errno::ENOENT, Errno::ESRCH
|
rescue Errno::ENOENT, Errno::ESRCH
|
||||||
# someone else did our job for us
|
logger.info 'Unicorn master already killed. Someone else did our job for us.'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue