Skip to content

Commit

Permalink
fix thingsapi#125: Close database connection after each query
Browse files Browse the repository at this point in the history
Each query creates a new DB connection.
This change is to close each new connection rather than leaving
them open, to allow for runs which involve large numbers of queries.
  • Loading branch information
mbhutton committed Oct 27, 2024
1 parent 96c90d5 commit d65b890
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion things/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,9 @@ def execute_query(self, sql_query, parameters=(), row_factory=None):
cursor = connection.cursor()
cursor.execute(sql_query, parameters)

return cursor.fetchall()
result = cursor.fetchall()
connection.close()
return result


# Helper functions
Expand Down

0 comments on commit d65b890

Please sign in to comment.