Skip to content

Commit d65b890

Browse files
committed
fix #125: Close database connection after each query
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.
1 parent 96c90d5 commit d65b890

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

things/database.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,9 @@ def execute_query(self, sql_query, parameters=(), row_factory=None):
503503
cursor = connection.cursor()
504504
cursor.execute(sql_query, parameters)
505505

506-
return cursor.fetchall()
506+
result = cursor.fetchall()
507+
connection.close()
508+
return result
507509

508510

509511
# Helper functions

0 commit comments

Comments
 (0)