Closed josevalim closed 8 years ago
I think we could use Task.Supervisor.start_child
to start a task that reuses DBConnection.run/3
by creating a fake DBConnection.Task
pool module. That should allow Ecto to use its query API on on_connect, instead of the drivers.
I think its ok to accept {mod, fun, args} | ((DBConnection.t) -> any)
like a Task. If you want something different let me know.
@fishcakez honestly, I don't care about folks using ecto API in after_connect. If you need to use it, it will be mostly a db specific command anyway, so you may as well go through the driver. So feel free to do the simplest thing :)
We should do this here or in Ecto. Keep in mind we don't need to keep Ecto API, we could for example ask a tuple of
{Mod, fun, args}
to be given on configuration.