diff mbox series

[scarthgap,2.8,1/2] persist_data: close connection in SQLTable __exit__

Message ID 20241125171204.1263284-1-chris.laplante@agilent.com
State New
Headers show
Series [scarthgap,2.8,1/2] persist_data: close connection in SQLTable __exit__ | expand

Commit Message

chris.laplante@agilent.com Nov. 25, 2024, 5:12 p.m. UTC
From: Chris Laplante <chris.laplante@agilent.com>

A Connection's __exit__ does not close the connection, but rather deals
with transactions. See https://docs.python.org/3/library/sqlite3.html#how-to-use-the-connection-context-manager

This change is not necessary on 'master' because persist_data was
removed.

Signed-off-by: Chris Laplante <chris.laplante@agilent.com>
---
 lib/bb/persist_data.py | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/lib/bb/persist_data.py b/lib/bb/persist_data.py
index bcca791ed..c4454b153 100644
--- a/lib/bb/persist_data.py
+++ b/lib/bb/persist_data.py
@@ -154,6 +154,7 @@  class SQLTable(collections.abc.MutableMapping):
 
     def __exit__(self, *excinfo):
         self.connection.__exit__(*excinfo)
+        self.connection.close()
 
     @_Decorators.retry()
     @_Decorators.transaction