我有一個接受圖片上傳的應用程序。這是一款使用獨角獸的heroku上的rails 3應用程序。我偶爾會遇到異常,而且我不知道是什麼原因導致它們或如何處理這些異常。我該怎麼辦?我可以在我的heroku rails應用程序上對獨角獸:: clientshutdown錯誤做些什麼?
這是我unicorn.rb
文件:
before_fork do |server, worker|
# Replace with MongoDB or whatever
if defined?(ActiveRecord::Base)
ActiveRecord::Base.connection.disconnect!
Rails.logger.info('Disconnected from ActiveRecord')
end
# If you are using Redis but not Resque, change this
if defined?(Resque)
Resque.redis.quit
Rails.logger.info('Disconnected from Redis')
end
end
after_fork do |server, worker|
# Replace with MongoDB or whatever
if defined?(ActiveRecord::Base)
ActiveRecord::Base.establish_connection
Rails.logger.info('Connected to ActiveRecord')
end
# If you are using Redis but not Resque, change this
if defined?(Resque)
Resque.redis = ENV['REDIS_URI']
Rails.logger.info('Connected to Redis')
end
end
是否麒麟日誌文件發現什麼了嗎? – 2014-03-07 01:15:20