Skip to content

Commit cd37384

Browse files
authored
Merge pull request #1796 from Kobzol/self-profile-upload-fix
Fix uploading S3 profiles
2 parents 9f03380 + 37d75a3 commit cd37384

File tree

1 file changed

+12
-1
lines changed
  • collector/src/compile/benchmark

1 file changed

+12
-1
lines changed

collector/src/compile/benchmark/mod.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,11 @@ impl Benchmark {
332332
preparation_start.elapsed().as_secs_f64()
333333
);
334334

335+
// We need to hold on to the directories to keep the files alive until
336+
// the processor post-processes them. We also store them in `ManuallyDrop`
337+
// so that they are not deleted when an error occurs.
338+
let mut timing_dirs: Vec<ManuallyDrop<TempDir>> = vec![];
339+
335340
let benchmark_start = std::time::Instant::now();
336341
for ((backend, profile), prep_dir) in &target_dirs {
337342
let backend = *backend;
@@ -408,7 +413,7 @@ impl Benchmark {
408413
}
409414
}
410415
}
411-
drop(ManuallyDrop::into_inner(timing_dir));
416+
timing_dirs.push(timing_dir);
412417
}
413418
}
414419
log::trace!(
@@ -417,6 +422,12 @@ impl Benchmark {
417422
benchmark_start.elapsed().as_secs_f64()
418423
);
419424
processor.postprocess_results().await;
425+
426+
// Now we can release the directories
427+
for dir in timing_dirs {
428+
drop(ManuallyDrop::into_inner(dir));
429+
}
430+
420431
Ok(())
421432
}
422433
}

0 commit comments

Comments
 (0)