Skip to content

Commit cb6e77b

Browse files
committed
refac
1 parent d4b90f9 commit cb6e77b

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

backend/open_webui/utils/automations.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from open_webui.models.chats import ChatForm, Chats
2727
from open_webui.models.users import Users
2828
from open_webui.utils.task import prompt_template
29-
from open_webui.internal.db import get_db
29+
from open_webui.internal.db import get_async_db
3030

3131
log = logging.getLogger(__name__)
3232

@@ -125,7 +125,7 @@ async def automation_worker_loop(app) -> None:
125125
log.info(f'Automation worker started (poll interval: {AUTOMATION_POLL_INTERVAL}s)')
126126
while True:
127127
try:
128-
with get_db() as db:
128+
async with get_async_db() as db:
129129
batch = await Automations.claim_due(int(time.time_ns()), limit=10, db=db)
130130
if batch:
131131
log.info(f'Claimed {len(batch)} due automation(s)')
@@ -428,5 +428,5 @@ async def _record_run(
428428
error: str = None,
429429
):
430430
"""Insert a run record into automation_run."""
431-
with get_db() as db:
431+
async with get_async_db() as db:
432432
await AutomationRuns.insert(automation_id, status, chat_id=chat_id, error=error, db=db)

0 commit comments

Comments
 (0)