diff mbox series

[styhead,2.10,1/2] persist_data: close connection in SQLTable __exit__

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

Commit Message

chris.laplante@agilent.com Nov. 25, 2024, 5:22 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>
(cherry picked from commit b0fba0f5af555ff970406b5cf3bf8fb113d953d1)
---
 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