Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to recover DB connection between two jobs in production ? #90

Open
geoffroymontel opened this issue Mar 28, 2015 · 3 comments
Open

Comments

@geoffroymontel
Copy link

Using backburner with ThreadsOnFork in production with Rails 4.2 and postgresql.

If I stop and restart the postgresql service on my Linux box, Rails can reconnect to the new postgresql service but the workers can't access to the new instance of the database.

I'm getting a PG::UnableToSend: no connection to the server error when the postgresql service is stopped and after it's restarted.

Some people had the same kind of problem with other queueing systems, and they recommend to run something like this

Resque.after_fork = Proc.new { ActiveRecord::Base.establish_connection }

How can I achieve this with Backburner ?

Should I put this in config.on_error ?

@freysie
Copy link

freysie commented Oct 8, 2015

+1

@contentfree
Copy link
Collaborator

I've actually been working on this the past couple days (it's coming as a side effect of handling dead connections to beanstalk).

The first revision will use the existing hook system so you'll likely need to either reopen the world class that you're using or subclass and extend.

@prashantham
Copy link

has the hook system available on latest version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants