awaitArriving
uses tcmts.cli.sync.historyArriving, which uses process
Wait for what's arriving of history, which a push sends and a merge starts from: while a process fetches it, until
it's done; with none fetching it (it stopped: the machine slept, the network dropped), fetch it here. say hears
how it's going.
import type { Codebase } from "#codebase/tcmts/cli/codebase"; import { fetchArriving, historyArriving } from "#codebase/tcmts/cli/sync"; export async function awaitArriving(cb: Codebase, say: (line: string) => void) { for (let now = historyArriving(cb); now.entries.length; now = historyArriving(cb)) { if (!now.fetcher) return fetchArriving(cb, say); const said = now.entries.find((a) => a.said)?.said; say(`waiting for the history still arriving${said ? `: ${said}` : ""}`); await new Promise((r) => setTimeout(r, 500)); } }