Search code examples
ruby-on-railspostgresqldelayed-job

When running bin/delayed_job start, postgres has no connection


When I run bin/delayed_job start, I get the following errors:

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

Solution

  • Solved by adding the following to config/initializers/delayed_job.rb

    ActiveRecord::Base.connection.reconnect!