Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Connection handling needs work inside web request handlers #3
In this case, we really do want to open connections using
See below for an example of the problem:
Furthermore the error handling should be moved to the top of the function and should not proceed if there is an error. An error here represents an error retrieving a database connection. Otherwise the code may proceed and try to do queries. For example:
Mixing client.end() and done() inside functions like this can be dangerous. Thankfully the code as written did not mix them. However, I ran across some code patterned after this that did, and the underlying pool logic can get confused and then fail to open a database connection entirely under certain conditions.
Please expect an immanent pull request that fixes these issues.