1

Apparently the pg gem uses prepared statements for Postgres. I have seen fixes for Unicorn to ensure that each process uses it's own db connection like so:

after_fork do |server, worker|
  ActiveRecord::Base.establish_connection
end

But I have no idea how to make this work with Resque.

4

1 回答 1

3

I found the answer. Please look at Christian Fazzini's answer here:

Rails Resque workers fail with PGError: server closed the connection unexpectedly

The error is different, but Christian's solution is the same, and it works.

于 2013-03-28T14:35:54.887 回答