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/routes.go +7−3

@@ -134,8 +134,10 @@ func (s *Server) repoRoutes(mux *http.ServeMux) {
134 134 w := s.Web
135 135
136 136 // Repository summary and feed, and the header's open counts. The tabs poll
137 // the counts while the page is visible.
137 // the counts while the window is focused, and the overview's recent runs
138 // poll their own rows.
138 139 mux.HandleFunc("GET /{name}", w.Overview)
140 mux.HandleFunc("GET /{name}/overview/runs", w.OverviewRuns)
139 141 mux.HandleFunc("GET /{name}/counts", w.RepoCounts)
140 142 mux.HandleFunc("GET /{name}/activity", w.Activity)
141 143 mux.HandleFunc("GET /{name}/sitemap.xml", w.RepoSitemap)
@@ -228,9 +230,11 @@ func (s *Server) repoRoutes(mux *http.ServeMux) {
228 230 mux.HandleFunc("GET /{name}/channels/{channel}", w.ChannelView)
229 231 mux.HandleFunc("GET /{name}/channels/{channel}/{path...}", w.ChannelFile)
230 232
231 // CI: the run list and one run with its log and artifacts. Cancel and rerun
232 // are the only writes.
233 // CI: the run list and one run with its log and artifacts. The list answers
234 // its poll with the counts, rows, and pager alone. Cancel and rerun are the
235 // only writes.
233 236 mux.HandleFunc("GET /{name}/runs", w.RunsPage)
237 mux.HandleFunc("GET /{name}/runs/live", w.RunsLive)
234 238 mux.HandleFunc("GET /{name}/workflows/dispatch", w.WorkflowDispatchPage)
235 239 mux.HandleFunc("POST /{name}/workflows/dispatch", w.WorkflowDispatch)
236 240 mux.HandleFunc("GET /{name}/runs/{id}", w.RunPage)