elixir-ecto / db_connection

Database connection behaviour
http://hexdocs.pm/db_connection/DBConnection.html
306 stars 113 forks source link

Is it possible to close and reconnect a DBConnection regularly? #305

Closed zche-theScore closed 8 months ago

zche-theScore commented 8 months ago

I skimmed through the code and it looks like that each connection in the connection pool is a long live connection, pinging regularly.

In my case, I would like to have each connection closes and immediately reconnects regularly, instead of pinging. (Another perspective is to add a connection to the pool and remove one in a FIFO sequence)

Is there already a configuration to do it? I didn't find anything fruitful through the docs and the code.

josevalim commented 8 months ago

No, there is no such option in DBConnection. Perhaps you can use a library like poolboy to achieve what you want. :)