Print last line of django db connection error while waiting for db to start #565
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is to address lack of output there since 4d320f3, which can hide potentially unrelated errors.
Related Issue: #562 - see more complete description of the problem there.
New Behavior
If there are any issues connecting to database or with any kind of loaded django settings, scripts or migrations, something like this will be printed:
Instead of just the last line and no information on the error, as it was since commit 4d320f3.
I've changed var name to DB_WAIT_DEBUG to be more in line with other tunables in this part of entrypoint script.
Discussion: Benefits and Drawbacks
Pros:
Not too verbose output, clearly indicating why db connection fails or any other potential issue, suggesting a way to get more information on the error to report it or debug further.
Cons:
Slightly more verbose output than nothing if database is slow to start for some reason.
Implementation is somewhat cryptic due to need to get error code out from the process substitution.
It doesn't need any kind of temporary files though, as don't think it's worth adding tmpfs just for this.
Possible to do same thing in different ways, but this one seem to be pure-bash, most efficient and straightforward, aside from exec/wait wrapping around "read".
Wiki / Release Note Entry
Just a small tweak, don't think it's worth mentioning anywhere.
Double Check
develop
branch.