[PATCH b4 v2 39/44] review-tui: close the tracking database when the status sync fails
Christian Brauner <[email protected]> Fri, 31 Jul 2026 23:59:20 +0200
| Newsgroups | org.kernel.linux.tools |
|---|---|
| Message-ID | <20260731-work-b4-editor-branch-guard-v2-39-243fd19d322d@kernel.org> |
The same leak as the auto-mark block and the archive: the close sits in the last statement of the try. This one runs once per reviewed series in a process that stays around. Close it in a finally. Signed-off-by: Christian Brauner (Amutable) <[email protected]> --- src/b4/review_tui/_entry.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/b4/review_tui/_entry.py b/src/b4/review_tui/_entry.py index 605fb12..f085cb4 100644 --- a/src/b4/review_tui/_entry.py +++ b/src/b4/review_tui/_entry.py @@ -189,6 +189,7 @@ def run_tracking_tui( # load_tracking() exits rather than raising on a branch with no # tracking commit, and SystemExit is not an Exception, so catch it # too -- letting it out of here takes the whole TUI down with it. + conn = None try: _cover_text, tracking = b4.review.load_tracking(topdir, branch_name) tracking_status = tracking.get('series', {}).get('status') @@ -198,9 +199,11 @@ def run_tracking_tui( b4.review.tracking.update_series_status( conn, focus_change_id, tracking_status, revision=revision ) - conn.close() except (Exception, SystemExit) as ex: logger.warning('Could not sync tracking status: %s', ex) + finally: + if conn is not None: + conn.close() # Put the user back before the tracking list comes up again. restore_original_head() -- 2.53.0