Skip to main content

Module wait_progress

Module wait_progress 

Source
Expand description

The shared clock of every wait notice: the grace, the repeat interval and a queued commit’s place in line. What: The shared clock of every wait notice: when the first line of a wait is due, how often it repeats, and the place in line a queued commit holds. Why: A commit that queues behind other commits, a lock, a reservation or a child process must say so, and say it again at a steady interval, or the caller cannot tell a queued commit from a hung one (issue 1811). Each wait loop feeds its elapsed time to a Ticker and prints a line when the ticker says one is due, so the decision is a function of elapsed time alone and a test can drive it with chosen durations. The interval comes from CLI_GIT_WAIT_NOTICE_SECONDS at the production entry of each wait.

In TS you’d write (pseudocode):

const ticker = new Ticker(Cadence.fromEnvironment());
while (waiting) { if (ticker.due(elapsedMs)) stderr.write(line(elapsedMs)); await wait(pollMs); }

Structs§

Cadence
What: When a wait’s notices are due: the grace before the first and the interval between the rest. Why: One value travels from the production entry to the wait loop, and tests choose short ones instead of waiting out the defaults.
ChildWaitFacts
What: What one notice of a wait for a child process says. Why: A child whose output goes to a file or a pipe is silent while it runs, so the wait names what it waits for, the child’s process, how long it has lasted and where it stops the child.
Ticker
What: Decides, from elapsed time alone, whether a notice is due, and when the next one will be. Why: A wait loop polls at its own pace. The ticker answers “is a line due now” once per due notice, however late the poll comes, and never answers twice for the same interval.
WaitReporter
What: Prints a wait’s notices to a sink at the pace of its ticker. Why: Wait loops that poll (reservations, child processes) share one printing rule: the line is built only when it is due, so a poll that is not due costs a clock read and nothing else.

Constants§

DEFAULT_NOTICE_INTERVAL
How often a waiting command repeats its notice when the variable is absent or unusable. Exempt from a citation under LQM (class: notice pacing): it times a line the person reads or a log threshold, and nothing waits on it beyond the wait that already exists. Classed once in doc/planning/cli-git-shipped-limits- audit.md, “Exempt limits”; the coordinator’s pick under the owner’s delegation, open to the owner’s veto.
NOTICE_GRACE
How long a wait stays silent before its first notice: a landing that holds the lock normally ends within this, so brief contention between healthy commits prints nothing. Exempt from a citation under LQM (class: notice pacing): it times a line the person reads or a log threshold, and nothing waits on it beyond the wait that already exists. Classed once in doc/planning/cli-git-shipped-limits- audit.md, “Exempt limits”; the coordinator’s pick under the owner’s delegation, open to the owner’s veto.
NOTICE_INTERVAL_VARIABLE
Environment variable that sets, in whole seconds, how often a waiting command repeats its notice.

Functions§

child_wait_line
What: The notice of a wait for a child process. Why: The first notice of a wait adds what to do if the child is stuck, and the repeats stay short.