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.
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.