Step 6: control socket and daemon
Unix-socket JSON-lines protocol replacing the printMSG sentinels, with an Emitter so scan code is agnostic about whether a terminal or a UI is watching. Daemon serves clients and runs a TTL-aware scheduler; commands funnel through one worker so scans cannot overlap, and the CLI proxies to a running daemon rather than competing with it. The pre-fetch retention sweep was emitting the terminal ReapDone event, which would have ended a client's read before the scan began. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RPyeapneuXrCdojsaiXGbe
This commit is contained in:
11
src/db.rs
11
src/db.rs
@@ -385,6 +385,17 @@ impl Db {
|
||||
}
|
||||
}
|
||||
|
||||
impl Db {
|
||||
/// (pending, downloaded) across all feeds, for the status command.
|
||||
pub fn counts(&self) -> Result<(i64, i64)> {
|
||||
let conn = self.conn.lock().unwrap();
|
||||
Ok((
|
||||
conn.query_row("SELECT count(*) FROM enclosures WHERE state = 'pending'", [], |r| r.get(0))?,
|
||||
conn.query_row("SELECT count(*) FROM enclosures WHERE path IS NOT NULL", [], |r| r.get(0))?,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
/// Unix seconds. Everything time-shaped in the DB is stored this way.
|
||||
pub fn now() -> i64 {
|
||||
std::time::SystemTime::now()
|
||||
|
||||
Reference in New Issue
Block a user