refac
This commit is contained in:
@@ -126,6 +126,10 @@ async def automation_worker_loop(app) -> None:
|
||||
log.info(f'Automation worker started (poll interval: {AUTOMATION_POLL_INTERVAL}s)')
|
||||
while True:
|
||||
try:
|
||||
if not getattr(app.state.config, 'ENABLE_AUTOMATIONS', False):
|
||||
await asyncio.sleep(AUTOMATION_POLL_INTERVAL)
|
||||
continue
|
||||
|
||||
async with get_async_db() as db:
|
||||
batch = await Automations.claim_due(int(time.time_ns()), limit=10, db=db)
|
||||
if batch:
|
||||
|
||||
@@ -551,7 +551,11 @@ async def get_builtin_tools(
|
||||
builtin_functions.extend([create_tasks, update_task])
|
||||
|
||||
# Automation tools - create and manage scheduled automations from chat
|
||||
if is_builtin_tool_enabled('automations') and await has_user_permission('automations'):
|
||||
if (
|
||||
is_builtin_tool_enabled('automations')
|
||||
and getattr(request.app.state.config, 'ENABLE_AUTOMATIONS', False)
|
||||
and await has_user_permission('automations')
|
||||
):
|
||||
builtin_functions.extend(
|
||||
[create_automation, update_automation, list_automations, toggle_automation, delete_automation]
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user