mirror of
https://github.com/openglow-org/forgefirm.git
synced 2026-09-28 17:11:15 -07:00
Stop a finished run's clock
Run.snapshot() computed elapsed_s from the current time on every call, whether the run had ended or not. The page shows the last run until the next one starts, and it polls, so a finished run's figure went on counting: the result badge said FAIL beside a number still climbing, and the run read as still going. On the bench reference a test that ended after 5082 s was showing 5242 s and rising. The figure a finished run should carry was already recorded next to it: finished["duration_s"], fixed when the result was written. snapshot() now returns that once the run has ended, and the live count only while it is running. Host-proven: two unit tests - a finished run's clock reads its duration and does not move across a poll, a running one's still climbs.
This commit is contained in:
@@ -164,7 +164,12 @@ class Run:
|
||||
notice = dict(self.notice) if self.notice else None
|
||||
return {
|
||||
"kind": self.kind, "id": self.id, "title": self.title,
|
||||
"started": self.started_ts, "elapsed_s": int(time.time() - self.started),
|
||||
# A finished run's clock stops: the page shows the last run
|
||||
# until the next one starts, and a live figure there counts
|
||||
# the time since, not the time it took.
|
||||
"started": self.started_ts,
|
||||
"elapsed_s": (self.finished["duration_s"] if self.finished
|
||||
else int(time.time() - self.started)),
|
||||
"log": lines, "dropped": self.dropped, "prompt": prompt, "notice": notice,
|
||||
"finished": self.finished, "aborting": self.aborted.is_set(),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user