mirror of
https://github.com/zeronsh/comet.git
synced 2026-11-16 18:57:19 +00:00
The sync dispatcher and remote-wake delivery polled SQLite every 100 ms, and dev-server discovery walked every user process every 2 s. Idle and with nothing open, that was 0.3–1.2% CPU and ~85 context switches/s. Sync dispatcher (doc_host.rs): a pass runs when something it serves changes: a durable sync job or outbox row (new store change signals), a sync request, a failed publication, a new handle, a chat's last viewer or writer leaving, a socket waiter anywhere in the process, a teardown ending, the registry's chats or its first sync. A 100 ms timer is armed only while a pass leaves work in flight that moves with time or client state: a connection catching up, owing a wake receipt or counting down its idle grace, a client closing, a chat waiting for a slot, reconciliation or a disk page still to go, a failed write to retry, a pinned warm set over budget. Passes stay 100 ms apart, so admissions keep their 4-per-100 ms bound. The fairness handoff, teardown joins and cursor paging are unchanged. Remote-wake delivery: wakes on sync-job changes, a delivery ending, or the workspace being wired. The eight-slot yield keeps its cursor, so eight dead hosts still can't starve a ninth chat. Dev-server discovery: scans only the process trees Zeron started (each process whose own origin marker names a chat or terminal hosted here, plus their descendants), reading each process's environment once per lifetime. With none alive, it parks until a run changes state, a terminal opens, this device's chat folders change, or an open preview loses its process. Otherwise it keeps its 2 s cadence. Space git checks: git runs only when an input of its answer changed (the .git entry, HEAD and the branch it names, config, packed-refs, shallow, global/system config). Watcher rescans and repository churn cost a few stats. A failed git call is never cached as the answer. Measured on a scratch engine (release, symbols), 60 s idle: 0.45% → 0.03% CPU, 68.8 → 7.3 context switches/s; the 30 s sample has no busy frame left. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: zeronsh[bot] <346184242+zeronsh[bot]@users.noreply.github.com> |
History
|
|
|---|---|---|
| .. | ||
| examples | ||
| src | ||
| tests | ||
| Cargo.toml | ||