Skip to content

Commit 48c666a

Browse files
committed
Auto merge of #697 - Mark-Simulacrum:skip-panic, r=Mark-Simulacrum
Avoid panicking on negative durations This currently causes a panic when loading a run's details page after it has finished the initial processing (but not yet completed log uploads, I think?).
2 parents 365c12f + 2f13d9f commit 48c666a

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/cli.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ impl Crater {
545545
fn workspace(&self, docker_env: Option<&str>, fast_init: bool) -> Result<Workspace, Error> {
546546
let mut builder = WorkspaceBuilder::new(&crater::dirs::WORK_DIR, &crater::USER_AGENT)
547547
.fast_init(fast_init)
548-
.fetch_registry_index_during_builds(false)
548+
.fetch_registry_index_during_builds(true)
549549
.command_timeout(Some(Duration::from_secs(15 * 60)))
550550
.command_no_output_timeout(Some(Duration::from_secs(5 * 60)))
551551
.running_inside_docker(std::env::var("CRATER_INSIDE_DOCKER").is_ok());

src/server/routes/ui/experiments.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,13 @@ struct ExperimentContext {
127127
}
128128

129129
fn humanize(duration: Duration) -> String {
130-
let duration = duration.to_std().expect("non-negative duration");
130+
let duration = match duration.to_std() {
131+
Ok(d) => d,
132+
Err(_) => {
133+
// Don't try to make it pretty as a fallback.
134+
return format!("{:?}", duration);
135+
}
136+
};
131137
if duration.as_secs() < 60 {
132138
format!("{duration:?}")
133139
} else if duration.as_secs() < 60 * 60 {

0 commit comments

Comments
 (0)