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/components.html +7−7

@@ -163,24 +163,24 @@
163 163 </div>
164 164 {{end}}
165 165
166 {{/* The timing line under a job on the overview or a change's checks. Each time
167 carries its label: a bare duration beside a bare age reads as two unexplained
168 numbers. A queued or running duration keeps counting in app.js, so the row
169 stays current without asking the server for a new page every second. */}}
166 {{/* The timing line under a job on the overview, the runs tab, or a change's
167 checks. A job has one clock, and which one it is follows the phase: a queued
168 job shows its queue wait, a running job its run time, and a finished job the
169 total it took. The label is what makes a bare number readable, and a waiting
170 or running value keeps counting in app.js, so the row stays current without
171 asking the server for a clock every second. The run page keeps the separate
172 duration and queue-wait cards: that is the page for both numbers. */}}
170 173 {{define "run_times"}}
171 174 {{if .Started.IsZero}}
172 175 {{if .Finished.IsZero}}
173 176 <span class="side-time">waiting <span data-clock-from="{{.Created.Unix}}">{{duration .Wait}}</span></span>
174 177 {{else}}
175 178 <span class="side-time">waited {{duration .Wait}}</span>
176 <span class="side-time">queued <span data-since="{{.Created.Unix}}">{{since .Created.Unix}}</span></span>
177 179 {{end}}
178 180 {{else if .Finished.IsZero}}
179 181 <span class="side-time">running <span data-clock-from="{{.Started.Unix}}">{{duration .Duration}}</span></span>
180 <span class="side-time">queued <span data-since="{{.Created.Unix}}">{{since .Created.Unix}}</span></span>
181 182 {{else}}
182 183 <span class="side-time">took {{duration .Duration}}</span>
183 <span class="side-time">queued <span data-since="{{.Created.Unix}}">{{since .Created.Unix}}</span></span>
184 184 {{end}}
185 185 {{end}}
186 186