diff options
author | Matthias Beyer <matthias.beyer@atos.net> | 2021-02-02 14:44:46 +0100 |
---|---|---|
committer | Matthias Beyer <matthias.beyer@atos.net> | 2021-02-02 14:44:47 +0100 |
commit | 1b792a07dd1f48b145ea2fc610f3476dadc774f0 (patch) | |
tree | fbe5df0bd2924b7a6eb366a55f01de2df529c41c /src | |
parent | 928b85f24bee213442a596675143eb06a29b1550 (diff) |
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 <matthias.beyer@atos.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/endpoint/scheduler.rs | 5 |
1 files changed, 3 insertions, 2 deletions
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<LogItem>, - bar: &'a ProgressBar, + bar: ProgressBar, } impl<'a> LogReceiver<'a> { |