dtekcth / dfotose

DFotos hemsida
BSD 3-Clause "New" or "Revised" License
0 stars 3 forks source link

Retry database connection on failure #29

Closed dheurlin closed 5 years ago

dheurlin commented 5 years ago

When started in a Docker container, MongoDB will sometimes take a while to start, which results in node being unable to connect as the database is not yet ready to accept connections when it attempts to do so. To remedy this, we simply retry if an attempt at connecting fails. Ideally, we would like to have docker wait for mongoDB to start before launching the node application, but this is currently not possible since Docker considers the database to be ready as soon as its process is started, and not when it's actually ready to accept connections. Hence, this seems to be the best we can do at the moment.