Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application does not close database connections after use #2

Open
DavidHarper opened this issue Apr 29, 2022 · 0 comments
Open

Application does not close database connections after use #2

DavidHarper opened this issue Apr 29, 2022 · 0 comments

Comments

@DavidHarper
Copy link

The functions 'query' and 'save_to_database' in api.py open a new database connection every time they are called, but they don't close the connection before returning. Unfortunately, when Python deletes the no-longer-in-scope connection object, it too fails to close the database connection properly, but instead simply closes the underlying socket. This doesn't affect the web application, but every time it happens, the back-end database server writes an 'Aborted connection' error message to its log file. When the web application is being invoked many thousands of times a day, the database server log becomes filled with these messages, which can hide real error messages which the DBAs might need to see.

Please add a call to the database connection object's 'close' or 'disconnect' method in both 'query' and 'save_to_database'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant