请不要在的Phusion乘客的需要运行的应用程序,以重新ActiveRecord的叉? [英] Do apps running in Phusion Passenger need to reconnect ActiveRecord on fork?
问题描述
每本文档:
<一个href="http://www.modrails.com/documentation/Users%20guide%20Nginx.html#_smart_spawning_gotcha_1_unintentional_file_descriptor_sharing" rel="nofollow">http://www.modrails.com/documentation/Users%20guide%20Nginx.html#_smart_spawning_gotcha_1_unintentional_file_descriptor_sharing
套接字连接继续智能产卵操作之后被共享。上市的例子是Memcached的。
1是否有类似的重新连接的ActiveRecord在这种情况下,也?是这样的:
PhusionPassenger.on_event(:starting_worker_process)办|叉|
如果分叉
#我们在智能产卵模式。
ActiveRecord.establish_connection(...)
其他
#我们在保守的产卵模式。我们不需要做任何事情。
结束
结束
乘客会自动重新建立。在创建一个新的工作进程连接到数据库,根据向导,所以你不应该这样做。
您遇到会导致您认为这可能不是这样什么麻烦?
Per this documentation:
Socket connections continue to be shared after a Smart spawn operation. The example listed is for Memcached.
Does one have to similarly reconnect ActiveRecord in this case as well? Something like:
PhusionPassenger.on_event(:starting_worker_process) do |forked|
if forked
# We're in smart spawning mode.
ActiveRecord.establish_connection(...)
else
# We're in conservative spawning mode. We don't need to do anything.
end
end
passenger automatically reestablishes the connection to the database upon creating a new worker process, according to the guide, so you shouldn't have to do that.
Are you experiencing any trouble that would lead you to believe this might not be the case?
这篇关于请不要在的Phusion乘客的需要运行的应用程序,以重新ActiveRecord的叉?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!