Skip to content

Commit

Permalink
fix build time stats
Browse files Browse the repository at this point in the history
  • Loading branch information
xtexx committed Dec 22, 2024
1 parent 0a4d9b7 commit 8f109eb
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ use nix::unistd::gethostname;
use serde::{Deserialize, Serialize};

use crate::{
Container, Error, Result, SimpleAptRepository, Workspace,
repo::monitor::RepositoryRefreshMonitor,
repo::monitor::RepositoryRefreshMonitor, Container, Error, Result, SimpleAptRepository,
Workspace,
};

/// A build request.
Expand Down Expand Up @@ -174,7 +174,10 @@ impl BuildCheckPoint {

let start = Instant::now();
match execute(&mut self, container) {
Ok(out) => Ok(out),
Ok(mut out) => {
out.time_elapsed += start.elapsed().as_secs();
Ok(out)
}
Err(err) => {
self.time_elapsed += start.elapsed().as_secs();
Err((Some(self), err))
Expand Down Expand Up @@ -251,7 +254,9 @@ fn execute(
ckpt.progress = index;
}

refresh_monitor.stop().map_err(|err|BuildError::RefreshRepoError(err))?;
refresh_monitor
.stop()
.map_err(|err| BuildError::RefreshRepoError(err))?;
Ok(BuildOutput {
total_packages: total,
time_elapsed: ckpt.time_elapsed,
Expand Down

0 comments on commit 8f109eb

Please sign in to comment.