From 1d892ce2c513c4d933c902de5e5d76c317a06dd2 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Sat, 9 May 2026 06:33:26 +0900 Subject: [PATCH] refac --- backend/open_webui/models/calendar.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/backend/open_webui/models/calendar.py b/backend/open_webui/models/calendar.py index 47f0a6f722..48b28d8e9a 100644 --- a/backend/open_webui/models/calendar.py +++ b/backend/open_webui/models/calendar.py @@ -395,14 +395,16 @@ class CalendarTable: # Delete events await db.execute(delete(CalendarEvent).filter(CalendarEvent.calendar_id == id)) - # Delete access grants - await AccessGrants.revoke_all_access('calendar', id, db=db) - # Delete calendar await db.execute(delete(Calendar).filter(Calendar.id == id)) await db.commit() - return True - except Exception: + + # Revoke access grants in a separate transaction to avoid + # write-lock contention on SQLite when session sharing is off. + await AccessGrants.revoke_all_access('calendar', id) + return True + except Exception as e: + log.exception(f'Failed to delete calendar {id}: {e}') return False