fix: ARQ worker functions must be dotted module paths not objects
This commit is contained in:
+15
-51
@@ -28,58 +28,22 @@ async def on_shutdown(ctx: dict[str, Any]) -> None:
|
|||||||
logger.info("ARQ worker shutting down...")
|
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:
|
class WorkerSettings:
|
||||||
"""ARQ worker settings."""
|
"""ARQ worker settings.
|
||||||
functions = _collect_job_functions()
|
|
||||||
|
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()
|
redis_settings = _get_redis_settings()
|
||||||
on_startup = on_startup
|
on_startup = on_startup
|
||||||
on_shutdown = on_shutdown
|
on_shutdown = on_shutdown
|
||||||
|
|||||||
Reference in New Issue
Block a user