luplo.core.worker¶
Unified background worker for sync jobs and glossary term extraction.
Runs as lp worker start (Local mode) or inside the FastAPI server
lifespan (Remote mode). Uses PG LISTEN/NOTIFY with a 60-second fallback
poll to pick up work.
Channels:
- luplo_sync_jobs — notified when enqueue_sync creates/updates a job.
- luplo_new_items — notified when a new item is created (for glossary
candidate extraction). Post-v0.5.
Attributes¶
Functions¶
|
Main worker loop. Runs until cancelled. |
Module Contents¶
- luplo.core.worker.logger¶
- luplo.core.worker.POLL_INTERVAL_SECONDS = 60¶
- async luplo.core.worker.run_worker(pool: psycopg_pool.AsyncConnectionPool) None¶
Main worker loop. Runs until cancelled.
Listens for PG notifications on
luplo_sync_jobsand falls back to polling every 60 seconds. Each iteration claims ready sync jobs and processes them.- Parameters:
pool – Open connection pool to use for job queries.