Last active
June 20, 2020 04:48
-
-
Save hideack/c9ecf1c91f5c5f482ae261b6c8d846aa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| before_fork do |server, worker| | |
| ENV['BUNDLE_GEMFILE'] = "#{pj_root_dir}/current/Gemfile" | |
| # The following is only recommended for memory/DB-constrained | |
| # installations. It is not needed if your system can house | |
| # twice as many worker_processes as you have configured. | |
| # | |
| # # This allows a new master process to incrementally | |
| # # phase out the old master process with SIGTTOU to avoid a | |
| # # thundering herd (especially in the "preload_app false" case) | |
| # # when doing a transparent upgrade. The last worker spawned | |
| # # will then kill off the old master process with a SIGQUIT. | |
| old_pid = "#{server.config[:pid]}.oldbin" | |
| if old_pid != server.pid | |
| begin | |
| sig = (worker.nr + 1) >= server.worker_processes ? :QUIT : :TTOU | |
| Process.kill(sig, File.read(old_pid).to_i) | |
| rescue Errno::ENOENT, Errno::ESRCH | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment