jondot/sneakers

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

Opened this issue · 2 comments

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!

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.

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.