Skip to content

@Hengjie /gist:4633113
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Minimize Unicorn worker_processes in 'development' env
environment = ENV['RACK_ENV'] || ENV['RAILS_ENV'] || 'production'
# Save on RAM while in development
if environment == 'development'
worker_processes 1
else
worker_processes 4
end
timeout 30
preload_app true
before_fork do |server, worker|
# Close all open connections
if defined?(ActiveRecord::Base)
ActiveRecord::Base.connection.disconnect!
end
@resque_pid ||= spawn("bundle exec rake resque:work QUEUES=fast")
end
after_fork do |server, worker|
# Reopen all connections
if defined?(ActiveRecord::Base)
ActiveRecord::Base.establish_connection
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.