From 1b792a07dd1f48b145ea2fc610f3476dadc774f0 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 2 Feb 2021 14:44:46 +0100 Subject: Fix: Make sure that bar is moved to LogReceiver, drop it afterwards This patch makes the bar moved to the LogReceiver instead of borrowing it to it. Because ProgressBar::clone() is cheap (according to indicatif documentation it is just an Arc<> holding the actual object), we can do this here without fearing the overhead. Signed-off-by: Matthias Beyer --- src/endpoint/scheduler.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/endpoint/scheduler.rs b/src/endpoint/scheduler.rs index a4721a8..a993833 100644 --- a/src/endpoint/scheduler.rs +++ b/src/endpoint/scheduler.rs @@ -179,9 +179,10 @@ impl JobHandle { log_dir: self.log_dir.as_ref(), job_id, log_receiver, - bar: &self.bar, + bar: self.bar.clone(), } .join(); + drop(self.bar); let (run_container, logres) = tokio::join!(running_container, logres); let log = logres.with_context(|| anyhow!("Collecting logs for job on '{}'", ep.name()))?; @@ -320,7 +321,7 @@ struct LogReceiver<'a> { log_dir: Option<&'a PathBuf>, job_id: Uuid, log_receiver: UnboundedReceiver, - bar: &'a ProgressBar, + bar: ProgressBar, } impl<'a> LogReceiver<'a> { -- cgit v1.2.3