不要在乘客的Phusion需要运行的应用程序重新连接的A​​ctiveRecord叉?(Do app

2019-08-01 13:13发布

每本文档:

http://www.modrails.com/documentation/Users%20guide%20Nginx.html#_smart_spawning_gotcha_1_unintentional_file_descriptor_sharing

插座连接继续智能产卵操作之后被共享。 所列的例子是用于Memcached的。

难道一个有类似的ActiveRecord的重新连接在这种情况下呢? 就像是:

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

Answer 1:

乘客会自动重新建立在创建新的工作进程与数据库的连接,根据向导,所以你不应该这样做。

您是否遇到这将导致您认为这可能并非如此有困难吗?



文章来源: Do apps running in Phusion Passenger need to reconnect ActiveRecord on fork?