mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-05 02:41:34 +00:00
fix: automation still shows "Last run Never" after "Run now" (#31583)
* fix: automation still shows "Last run Never" after "Run now" Running an automation with "Run now" added the run to its history, but the automation page and the Automations list kept showing "Last run Never" (or the time of the last scheduled run). Only scheduled runs recorded a last run time. A manual run now records it too, so the automation page and the Automations list show the time of the run you just started. Fixes #31580 * fix: show the new last run time right after Run now The automation page now takes the automation the server returns after Run now, so the last run time updates on the spot and no reload is needed.
This commit is contained in:
parent
6419eca3a2
commit
e26da43076
3 changed files with 11 additions and 0 deletions
|
|
@ -244,6 +244,15 @@ class AutomationTable:
|
|||
await db.commit()
|
||||
return AutomationModel.model_validate(row)
|
||||
|
||||
async def update_last_run_at(self, id: str, db: Optional[AsyncSession] = None) -> Optional[AutomationModel]:
|
||||
async with get_async_db_context(db) as db:
|
||||
row = await db.get(Automation, id)
|
||||
if not row:
|
||||
return None
|
||||
row.last_run_at = int(time.time_ns())
|
||||
await db.commit()
|
||||
return AutomationModel.model_validate(row)
|
||||
|
||||
async def clear_folder_ids(
|
||||
self,
|
||||
user_id: str,
|
||||
|
|
|
|||
|
|
@ -341,6 +341,7 @@ async def run_automation_by_id(
|
|||
await check_automations_permission(request, user)
|
||||
automation = await Automations.get_by_id(id, db=db)
|
||||
check_automation_access(automation, user)
|
||||
automation = await Automations.update_last_run_at(automation.id, db=db)
|
||||
asyncio.create_task(execute_automation(request.app, automation))
|
||||
await publish_event(
|
||||
request,
|
||||
|
|
|
|||
|
|
@ -167,6 +167,7 @@
|
|||
return null;
|
||||
});
|
||||
if (res) {
|
||||
automation = res;
|
||||
toast.success($i18n.t('Automation triggered'));
|
||||
setTimeout(() => loadRuns(false), 2000);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue