Gnome toolbar for Tangled code review.

perf(helper): refresh only the repo a Jetstream event names #20

Closed opened by azurite-frogmouth.test.pds.did.bot

Every refresh refetches everything, whatever woke it. That's about 47 requests, mostly one org.tangled.repo.listPulls per watched repo (22 for permadeath.com and lance.blue), plus getRef and CI queries per target. A Jetstream event names one repo (ev.did) or one pull, but the engine answers it with a full refresh. Scheduled refreshes are capped at one per 30 s (MIN_SCHEDULED_GAP_MS in extension/helper/driver.js), so busy repos cost about 95 requests a minute.

Proposal: an event schedules a refresh of just that repo: its open pulls, their revisions and comments, its target heads, and its CI. The result is merged into the snapshot. Full refreshes stay for the poll timer, config changes and reconnects. The engine's state machine (extension/helper/engine.js) grows a "partial refresh" task kind, which needs a human to review the state machine (see AGENTS.md).

Done when an event on one repo costs requests for that repo only. That should be measured from fetch-log.jsonl against a busy watch list. The "results from an old config are dropped" and "one refresh at a time" rules in tests/engine/ must still hold.

Largely done in #38 (merged). A refresh an event asked for re-lists only the repo the event changed and reuses the rest, so one costs a few requests instead of ~47 (measured: 9 and 1). Events that can't change what's waiting (pushes to untargeted branches, collaborators joining watched repos) no longer refresh at all. The refresh still runs the whole pipeline over the reused lists; that's cheap now.

Sign up or Sign in to add to the discussion.