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

@@ -138,11 +138,11 @@
138 138 </div>
139 139 {{/* One poll for the header's counts. The response is out-of-band updates to
140 140 the two badges, so the tabs are not re-rendered and the page keeps its
141 state. It pauses while the tab is hidden, so a forgotten page does not
142 keep asking. */}}
141 state. It pauses while the window is unfocused, so a forgotten page does
142 not keep asking, and answers a vole-refresh when it comes back. */}}
143 143 <nav class="tabs" aria-label="Repository"
144 144 hx-get="/{{.Name}}/counts"
145 hx-trigger="every 30s"
145 hx-trigger="every 30s, vole-refresh from:body"
146 146 hx-sync="this:replace"
147 147 hx-swap="none">
148 148 <a class="repotab{{if eq .Tab "overview"}} active{{end}}" href="/{{.Name}}"{{if eq .Tab "overview"}} aria-current="page"{{end}}>{{icon "layout-dashboard"}}Overview</a>
@@ -155,6 +155,10 @@
155 155 <a href="/{{.Name}}/locks"{{if eq .Tab "locks"}} class="active" aria-current="page"{{end}}>{{icon "lock"}}Locks</a>
156 156 {{if .CanAdmin}}<a href="/{{.Name}}/settings"{{if eq .Tab "settings"}} class="active" aria-current="page"{{end}}>{{icon "sliders-horizontal"}}Settings</a>{{end}}
157 157 </nav>
158 {{/* A page whose window is not focused is not being refreshed; app.js fills
159 this in with how old its last answer is. It is absolutely placed so
160 gaining and losing focus does not move the page under the reader. */}}
161 <p class="live-note" data-live-note hidden></p>
158 162 </div>
159 163 {{end}}
160 164