Closed sonic182 closed 2 years ago
That's not a decision imposed by db_connection. You can async/lazily connect, but you implement it in your callbacks.
Is there any example of that?
it is complicated to specify a custom pool module for opts in Repo, it is heavy sticket to the one implemented here in db_connection and the Holder
Look at Postgrex. It attempts to connect on init, but if it fails, it does so asynchronously. The same principle could be used for laziness. It is a matter of not doing it on init but when the callbacks are invoked.
db_connection supports lazy pools?
I mean, create connections by demand and close them if idle