Skip to content

Application does not close database connections after use #2

@DavidHarper

Description

@DavidHarper

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'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions