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.
Show the total from enqueue to finish for a finished run
4489805d9d86920f41469f281c91a19acb904e58 · Keenan Nemetz · 9d ago · parent aa38f6b2
Show the total from enqueue to finish for a finished run A finished row's one clock should be the whole job, not just the part after the first lease: the queue wait and the run are the same job, and the phases add up to it. A run still in progress keeps the phase clock it is in.
ci/runs/runs.go +17
| @@ -323,6 +323,23 @@ func (r *Run) Duration() time.Duration { | |||
| 323 | 323 | return end.Sub(r.Started) | |
| 324 | 324 | } | |
| 325 | 325 | ||
| 326 | // Total is the whole time from enqueue to finish: the queue wait and the run are | ||
| 327 | // one job, so a finished row shows the number both phases add up to. A run still | ||
| 328 | // in progress is measured to now, which is its wait plus its run so far. | ||
| 329 | func (r *Run) Total() time.Duration { | ||
| 330 | if r.Created.IsZero() { | ||
| 331 | return 0 | ||
| 332 | } | ||
| 333 | end := r.Finished | ||
| 334 | if end.IsZero() { | ||
| 335 | end = time.Now().UTC() | ||
| 336 | } | ||
| 337 | if end.Before(r.Created) { | ||
| 338 | return 0 | ||
| 339 | } | ||
| 340 | return end.Sub(r.Created) | ||
| 341 | } | ||
| 342 | |||
| 326 | 343 | // Wait is the time between enqueue and the first lease. A queued run is measured to | |
| 327 | 344 | // now, because "waiting for a runner" is the useful number while it waits. | |
| 328 | 345 | func (r *Run) Wait() time.Duration { | |