From cb6e77be3ec6ce00dd1f5b9ce3a655e6f65bc5da Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Sun, 12 Apr 2026 22:10:43 -0500 Subject: [PATCH] refac --- backend/open_webui/utils/automations.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/open_webui/utils/automations.py b/backend/open_webui/utils/automations.py index 45b7ba65ab..5997b0e58b 100644 --- a/backend/open_webui/utils/automations.py +++ b/backend/open_webui/utils/automations.py @@ -26,7 +26,7 @@ from open_webui.models.automations import Automations, AutomationRuns, Automatio from open_webui.models.chats import ChatForm, Chats from open_webui.models.users import Users from open_webui.utils.task import prompt_template -from open_webui.internal.db import get_db +from open_webui.internal.db import get_async_db log = logging.getLogger(__name__) @@ -125,7 +125,7 @@ async def automation_worker_loop(app) -> None: log.info(f'Automation worker started (poll interval: {AUTOMATION_POLL_INTERVAL}s)') while True: try: - with get_db() as db: + async with get_async_db() as db: batch = await Automations.claim_due(int(time.time_ns()), limit=10, db=db) if batch: log.info(f'Claimed {len(batch)} due automation(s)') @@ -428,5 +428,5 @@ async def _record_run( error: str = None, ): """Insert a run record into automation_run.""" - with get_db() as db: + async with get_async_db() as db: await AutomationRuns.insert(automation_id, status, chat_id=chat_id, error=error, db=db)