build-logs: extract compute_runtime_secs helper; clamp runtime in js
This commit is contained in:
parent
008609d0e7
commit
aa96d76e73
2 changed files with 7 additions and 3 deletions
|
|
@ -333,7 +333,7 @@ impl BuildLogs {
|
|||
.query_row(params![id], |r| {
|
||||
let started_at: i64 = r.get(4)?;
|
||||
let finished_at: Option<i64> = r.get(5)?;
|
||||
let runtime_secs = finished_at.map(|f| f - started_at);
|
||||
let runtime_secs = compute_runtime_secs(started_at, finished_at);
|
||||
Ok(BuildLogFull {
|
||||
header: BuildLogHeader {
|
||||
id: r.get(0)?,
|
||||
|
|
@ -410,10 +410,14 @@ pub fn spawn_vacuum(coord: &Arc<crate::coordinator::Coordinator>) {
|
|||
});
|
||||
}
|
||||
|
||||
fn compute_runtime_secs(started_at: i64, finished_at: Option<i64>) -> Option<i64> {
|
||||
finished_at.map(|f| f - started_at)
|
||||
}
|
||||
|
||||
fn row_to_header(r: &rusqlite::Row) -> rusqlite::Result<BuildLogHeader> {
|
||||
let started_at: i64 = r.get(4)?;
|
||||
let finished_at: Option<i64> = r.get(5)?;
|
||||
let runtime_secs = finished_at.map(|f| f - started_at);
|
||||
let runtime_secs = compute_runtime_secs(started_at, finished_at);
|
||||
Ok(BuildLogHeader {
|
||||
id: r.get(0)?,
|
||||
agent: r.get(1)?,
|
||||
|
|
|
|||
Loading…
Reference in a new issue