ruby-on-rails - 运行bin/delayed_job start时,postgres没有连接

标签 ruby-on-rails postgresql delayed-job

当我运行 bin/delayed_job start 时,出现以下错误:

Job ActiveJob::QueueAdapters::DelayedJobAdapter::JobWrapper (id=30) FAILED (0 prior attempts) with ActiveRecord::StatementInvalid: PG::ConnectionBad: PQconsumeInput() server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.

PG::UnableToSend: no connection to the server

最佳答案

通过将以下内容添加到 config/initializers/delayed_job.rb 解决

ActiveRecord::Base.connection.reconnect!

关于ruby-on-rails - 运行bin/delayed_job start时,postgres没有连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36902259/

相关文章:

ruby-on-rails - 为 delayed_job 设置 MAX_RUN_TIME - 我可以设置多少时间?

ruby-on-rails - I18n 自定义异常处理程序不使用 `t` 调用,仅使用 `I18n.translate`

java - 当 NULL LocalDate 作为输入给出时, native 命名查询失败并出现异常 "column is of type date but expression is of type bytea"

ruby-on-rails - 您如何在单个 Heroku dyno 上运行多个 DelayedJob 工作人员?

java - 准备好的语句 executeUpdate 不适用于更新语句

sql - 如何从第一行开始更新表列的行?

ruby-on-rails - Rails 延迟作业和库类

mysql - 为什么 Rails 说 "cannot load such file mysql/mysql_api"?

ruby-on-rails - 嵌套对象 has_one 关系

ruby-on-rails - 如何在 Rails 中使用 Authlogic 跳过电子邮件验证?