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

Documentation not very clear on how to handle DB connections when using the gem in a Rails application #478

Open
vikram-a opened this issue Jul 6, 2023 · 2 comments

Comments

@vikram-a
Copy link

vikram-a commented Jul 6, 2023

Hi,

I find that the documentation is insufficient in describing how to handle DB connections when using the gem as a Rails worker. This example of having a hook close existing connection and create a new one for every worker does not seems efficient. Is there a recommended way to simply use the connection from the pool and return it cleanly?

Thanks!

@michaelklishin
Copy link
Collaborator

Opening a new connection for long running processes is perfectly efficient and matches how connections in the messaging protocols supported by RabbitMQ are expected to be used.

Due to fork(2) effects on previously opened file handles, you won't be able to avoid doing what the example does, one way or another.

@vikram-a
Copy link
Author

vikram-a commented Jul 6, 2023

Opening a new connection for long running processes is perfectly efficient and matches how connections in the messaging protocols supported by RabbitMQ are expected to be used.

Due to fork(2) effects on previously opened file handles, you won't be able to avoid doing what the example does, one way or another.

Hi! I was talking about database connections.

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

2 participants