[PATCH b4 v2 03/44] review: close the messages database when auto-marking fails
Christian Brauner <[email protected]> Fri, 31 Jul 2026 23:58:44 +0200
| Newsgroups | org.kernel.linux.tools |
|---|---|
| Message-ID | <20260731-work-b4-editor-branch-guard-v2-3-243fd19d322d@kernel.org> |
The auto-mark block closes the messages database in the last statement of the try, so anything raising before that leaks the connection. This runs once per tracked series per refresh in a process that stays around. Close it in a finally. Signed-off-by: Christian Brauner (Amutable) <[email protected]> --- src/b4/review/_review.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/b4/review/_review.py b/src/b4/review/_review.py index cba3a0f..da20fc4 100644 --- a/src/b4/review/_review.py +++ b/src/b4/review/_review.py @@ -2596,6 +2596,7 @@ def update_series_tracking( # so the unread badge below never lights up for them. seen_bump = 0 if thread_msgs and change_id: + mconn = None try: from b4.review import messages @@ -2619,9 +2620,11 @@ def update_series_tracking( for mid in new_msgids if 'Seen' in flags_map.get(mid, '').split() ) - mconn.close() except Exception as ex: logger.debug('Could not auto-mark own messages as read: %s', ex) + finally: + if mconn is not None: + mconn.close() # Update message count and thread blob from the already-fetched # thread messages. No status filtering here: the thread is already -- 2.53.0