Process split: cangcang (daemon) + cangjian (web) #143
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Cang currently runs as a single process doing ingest, cleanup, and web serving in one asyncio event loop. All DB operations share aiosqlite's single background thread, so during periodic scans web requests queue behind writes and the UI hangs.
Split into two processes — cangcang (ingest/cleanup daemon) and cangjian (web server). Both share SQLite via WAL mode.
Also fixes issue #131 (deploy-docs token handling).
Design spec: .superpowers/specs/2026-08-12-cang-process-split-design.md
Plan of attack
Two new entry points from the existing codebase, no logic changes:
src/cang/daemon.py— extract all ingest/cleanup/periodic-loop functions fromweb/lifespan.pyinto a new module. Exposesrun_daemon(cfg, db).src/cang/web/server.py— newcangjianentry point. PlainFastAPI()app (no lifespan), uvicorn.web/app.py— drop lifespan import and kwarg.cli.pyandweb/lifespan.py.Containerfile—CMD ["cangjian", "/config/cang.toml"]instead of ENTRYPOINT.cangcang.containerandcangjian.container.Full plan:
.superpowers/plans/2026-08-12-cang-process-split.mdDesign spec:
.superpowers/specs/2026-08-12-cang-process-split-design.md