From 797049591809d60b0718b14841ac55663c33f57d Mon Sep 17 00:00:00 2001 From: Agent Zero Date: Sun, 19 Jul 2026 19:39:41 +0200 Subject: [PATCH] fix: ARQ worker functions must be dotted module paths not objects --- app/core/worker.py | 66 +++++++++++----------------------------------- 1 file changed, 15 insertions(+), 51 deletions(-) diff --git a/app/core/worker.py b/app/core/worker.py index da1560a..b546b70 100644 --- a/app/core/worker.py +++ b/app/core/worker.py @@ -28,58 +28,22 @@ async def on_shutdown(ctx: dict[str, Any]) -> None: logger.info("ARQ worker shutting down...") -def _collect_job_functions() -> dict[str, Any]: - """Collect all job functions from plugins and core. - - Each plugin's jobs module may define async functions with the - signature (ctx: dict, *args) -> None. We import them all and - register by name. - """ - functions: dict[str, Any] = {} - - # Unified search jobs - try: - from app.plugins.builtins.unified_search.jobs import ( - index_mails, - index_file, - index_contact, - index_company, - index_event, - reindex, - embedding_batch, - ) - functions.update({ - "index_mails": index_mails, - "index_file": index_file, - "index_contact": index_contact, - "index_company": index_company, - "index_event": index_event, - "reindex": reindex, - "embedding_batch": embedding_batch, - }) - except Exception: - logger.warning("Failed to import unified_search jobs", exc_info=True) - - # AI proactive jobs - try: - from app.plugins.builtins.ai_proactive.jobs import deep_analysis - functions["deep_analysis"] = deep_analysis - except Exception: - logger.warning("Failed to import ai_proactive jobs", exc_info=True) - - # Calendar jobs (calendar_reminder is enqueued but no handler exists yet) - # try: - # from app.plugins.builtins.calendar.jobs import calendar_reminder - # functions["calendar_reminder"] = calendar_reminder - # except Exception: - # logger.warning("Failed to import calendar jobs", exc_info=True) - - return functions - - class WorkerSettings: - """ARQ worker settings.""" - functions = _collect_job_functions() + """ARQ worker settings. + + functions must be dotted module paths to async callables, + e.g. 'app.plugins.builtins.unified_search.jobs.reindex' + """ + functions = [ + "app.plugins.builtins.unified_search.jobs.index_mails", + "app.plugins.builtins.unified_search.jobs.index_file", + "app.plugins.builtins.unified_search.jobs.index_contact", + "app.plugins.builtins.unified_search.jobs.index_company", + "app.plugins.builtins.unified_search.jobs.index_event", + "app.plugins.builtins.unified_search.jobs.reindex", + "app.plugins.builtins.unified_search.jobs.embedding_batch", + "app.plugins.builtins.ai_proactive.jobs.deep_analysis", + ] redis_settings = _get_redis_settings() on_startup = on_startup on_shutdown = on_shutdown