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/web/templates/requests.html +5−3

@@ -104,11 +104,13 @@
104 104
105 105 {{/* The aside is the page's live coordinator. The poll never replaces this element:
106 106 it returns out-of-band updates for the data-only regions, so a search, a
107 target picker, or an open composer is not thrown away. */}}
107 target picker, or an open composer is not thrown away. It also answers a
108 vole-refresh when the window regains focus, so a check that finished while
109 the page was away is current before the reader has to ask. */}}
108 110 {{define "request_aside"}}
109 <div id="request-aside"
111 <div id="request-aside" data-live
110 112 hx-get="/{{.Name}}/changes/{{.Request.ID}}/live"
111 hx-trigger="every 20s"
113 hx-trigger="every 20s, vole-refresh from:body"
112 114 hx-sync="this:replace"
113 115 hx-swap="none">
114 116 {{template "request_sidebar" .}}