update real world usage connection pool to use supervisor behavior
My setup requires the children defined before MyApp.Redix to be started before its child_spec can run (need to read some data from somewhere else) and I struggled for a bit with it so I think it might be worth updating the document to a more fool-proof default.
I think use Supervisor is better than manually setup through child_spec since it follows OTP convention and is easier to debug, it also means whichever is specified before MyApp.Redix in the main supervisor tree is actually started before we do anything with MyApp.Redix.
Hi @bubiche, thanks for the issue.
it follows OTP convention
I don't think it necessarily does? Module-based supervisors vs Supervisor.start_links are not an OTP convention as far as Iām aware.
easier to debug
How?
it also means whichever is specified before MyApp.Redix in the main supervisor tree is actually started before we do anything with MyApp.Redix.
This is the same with the previous approach, as Supervisor.start_link/2 will still block until its children get started.
My setup requires the children defined before MyApp.Redix to be started before its child_spec can run
In this case yes you will need to "init" the supervisor after other things have been started, but it seems like a less common case. Can you elaborate with a more concrete example? š