CountsService
Defined in: src/backlog.ts:127
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new CountsService(
forges,run,fetchFn?,maxConcurrency?,getRepoConfig?):CountsService
Defined in: src/backlog.ts:137
Parameters
Section titled “Parameters”forges
Section titled “forges”fetchFn?
Section titled “fetchFn?”typeof fetch = fetch
maxConcurrency?
Section titled “maxConcurrency?”number = DEFAULT_MAX_CONCURRENCY
getRepoConfig?
Section titled “getRepoConfig?”(repoPath) => object
Optional: when provided, lightweight repos are treated as not-forge-backed. Read per call so a runtime repoMode toggle propagates without a restart.
Returns
Section titled “Returns”CountsService
Methods
Section titled “Methods”counts()
Section titled “counts()”counts(
repoPath):Promise<RepoCounts>
Defined in: src/backlog.ts:160
Read-through: serve a TTL-fresh cached value, else load it.
Parameters
Section titled “Parameters”repoPath
Section titled “repoPath”string
Returns
Section titled “Returns”Promise<RepoCounts>
peek()
Section titled “peek()”peek(
repoPath):RepoCounts|null
Defined in: src/backlog.ts:155
Synchronous cache-only peek — returns the last cached value for repoPath (regardless
of TTL freshness) or null when nothing has been cached yet. Never triggers a fetch, so
a caller on the event loop (e.g. the rundown’s backlog-priority ranking) can read the
kept-warm cache without an async forge round-trip. The backlog poller keeps these warm.
Parameters
Section titled “Parameters”repoPath
Section titled “repoPath”string
Returns
Section titled “Returns”RepoCounts | null
refresh()
Section titled “refresh()”refresh(
repoPath):Promise<RepoCounts>
Defined in: src/backlog.ts:177
Force a refetch regardless of TTL — used by the background warmer to rewrite the cached value on a cadence so the request path always finds a fresh entry. Single-flight still dedupes against any in-flight load.
preserveOnError: a warm failure keeps the last-known-good value instead of
clobbering it with nulls. The warmer runs every 45s, so without this a brief
gh/network flake would blink the overview’s counts to null until the next
successful warm. A genuinely expired entry still falls back to a live fetch
on the request path, so persistent failures eventually surface as null.
Parameters
Section titled “Parameters”repoPath
Section titled “repoPath”string
Returns
Section titled “Returns”Promise<RepoCounts>