-
Notifications
You must be signed in to change notification settings - Fork 1
Description
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'.