Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Site
Clone

Read only, no credentials:

https://rodent.software/vole.git

Write over SSH with a registered key:

git clone ssh://git@rodent.software/vole.git

Self-hosted forge that lives in your Git repo.

Refresh run status on focus and show one clock per job

aa38f6b2428795995009fbe14a0b5a82b83006c6 · Keenan Nemetz · 9d ago · parent 8ca8bbe0

Refresh run status on focus and show one clock per job

A page in an unfocused window kept its durations moving while its status
stopped changing. The clock is arithmetic from a start timestamp, so it jumps
to the right value when the reader returns; the status is server-rendered HTML
that only moves when something re-fetches it. The result was a page minutes
behind that looked current.

Hidden and unfocused windows are not being read, so the answer is not to keep
polling them. The polls now skip a tick while the window is unfocused and mark
their region stale; the repository header says how old the last answer is, and
queued or running dots go hollow and stop pulsing. Returning to the window
dispatches vole-refresh, which every poll answers immediately instead of
waiting out its interval. The stale mark is cleared only by a refresh that
succeeded. Finished statuses are never marked, because they cannot change.

The overview's recent runs and the runs tab now poll too, and the run page
keeps itself current while a run is queued as well as running, so a queued
page picks up the start it was waiting for. A run row shows one clock: the
queue wait while queued, the run time while running, and the total it took once
finished. The run page keeps its separate duration and queue-wait cards, which
is where both numbers belong.

A running job's status dot pulses while the page is live.

Fixes #367.

server/issues_changes_test.go +2−2

@@ -557,7 +557,7 @@ func TestChangeLinksIssuesFromTheIssuesSection(t *testing.T) {
557 557 `id="request-issues"`, "First linked issue", `value="` + first + `"`,
558 558 `value="remove"`, `request-unlink`, `class="request-issue-search"`,
559 559 `hx-get="/` + f.repo + `/changes/` + id + `/live"`,
560 `hx-trigger="every 20s"`, `hx-swap="none"`,
560 `hx-trigger="every 20s, vole-refresh from:body"`, `hx-swap="none"`,
561 561 } {
562 562 if !strings.Contains(page, want) {
563 563 t.Fatalf("the request page is missing %q:\n%s", want, page)
@@ -1393,7 +1393,7 @@ func TestRepoTabCountsPollOutOfBand(t *testing.T) {
1393 1393 `id="repo-issue-count"`,
1394 1394 `id="repo-request-count"`,
1395 1395 `hx-get="/` + f.repo + `/counts"`,
1396 `hx-trigger="every 30s"`,
1396 `hx-trigger="every 30s, vole-refresh from:body"`,
1397 1397 } {
1398 1398 if !strings.Contains(page, want) {
1399 1399 t.Fatalf("the repository header does not show %q:\n%s", want, page)