From daf107a9934bd1f366300d17809839fde6e15f58 Mon Sep 17 00:00:00 2001 From: DrMelone <27028174+Classic298@users.noreply.github.com> Date: Sun, 12 Apr 2026 22:48:25 +0200 Subject: [PATCH] fix: prevent transient errors from permanently killing cleanup loops --- backend/open_webui/socket/main.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/backend/open_webui/socket/main.py b/backend/open_webui/socket/main.py index fbbe3ff52b..04e194a9fd 100644 --- a/backend/open_webui/socket/main.py +++ b/backend/open_webui/socket/main.py @@ -186,10 +186,16 @@ async def run_with_lock(acquire_fn, renew_fn, release_fn, work_fn, interval, loc if not renew_fn(): log.info('Lock renewal failed. Will re-acquire.') break - await work_fn() + try: + await work_fn() + except Exception: + log.exception('Periodic work_fn failed; will retry next cycle') await asyncio.sleep(interval) finally: - release_fn() + try: + release_fn() + except Exception: + log.exception('Failed to release lock') async def periodic_session_pool_cleanup():