【问题标题】:"pg" Ruby gem is throwing a "prepared statement already exists" error from Resque“pg”Ruby gem 从 Resque 抛出“prepared statement already exists”错误
【发布时间】:2013-03-27 16:00:20
【问题描述】:

显然 pg gem 使用 prepared statements 来表示 Postgres。我已经看到了 Unicorn 的修复程序,以确保每个进程都使用它自己的数据库连接,如下所示:

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

但我不知道如何使用 Resque 进行这项工作。

【问题讨论】:

    标签: ruby-on-rails postgresql resque pg


    【解决方案1】:

    我找到了答案。请看Christian Fazzini这里的回答:

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

    错误是不同的,但Christian的解决方法是一样的,而且有效。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-01-13
      • 2011-10-21
      • 1970-01-01
      • 2012-02-24
      • 2020-03-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多