Sha256: cfd30cbdc9a92412afe46ecdb8bb435837cd6b97aa8748b8ab6ce34d51e89beb
Contents?: true
Size: 996 Bytes
Versions: 8
Compression:
Stored size: 996 Bytes
Contents
working_directory "<%= current_path %>" pid "<%= unicorn_pid %>" stderr_path "<%= unicorn_log %>" stdout_path "<%= unicorn_log %>" listen "<%= unicorn_socket %>" worker_processes <%= unicorn_workers %> timeout 120 preload_app true before_fork do |server, worker| # Disconnect since the database connection will not carry over if defined? ActiveRecord::Base ActiveRecord::Base.connection.disconnect! end # Quit the old unicorn process old_pid = "#{server.config[:pid]}.oldbin" if File.exists?(old_pid) && server.pid != old_pid begin Process.kill("QUIT", File.read(old_pid).to_i) rescue Errno::ENOENT, Errno::ESRCH # someone else did our job for us end end end after_fork do |server, worker| # Start up the database connection again in the worker if defined?(ActiveRecord::Base) ActiveRecord::Base.establish_connection end child_pid = server.config[:pid].sub(".pid", ".#{worker.nr}.pid") system("echo #{Process.pid} > #{child_pid}") end
Version data entries
8 entries across 8 versions & 1 rubygems