it will be helpful if somehow the db connection is lost or was not possible .
When using docker fastapi is ready before postgres although there are some solutions out there they are external it will be much better if we have internal solution. external solution are dependencies and in docker-compose there are many changes and there are many repos trying to solve it externally .
https://stackoverflow.com/questions/35069027/docker-wait-for-postgresql-to-be-running