From 4a438161d51caab341f621128d84297d2c9fc762 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 8 Dec 2020 13:25:01 +0100 Subject: Simplify: Pass ref to MergedStores object This reduces the runtime because the MergedStores object does not have to be created all the time, also, less parameters are passed to the run_jobset() function. Signed-off-by: Matthias Beyer --- src/orchestrator/orchestrator.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/orchestrator/orchestrator.rs') diff --git a/src/orchestrator/orchestrator.rs b/src/orchestrator/orchestrator.rs index 40d6797..aea6a96 100644 --- a/src/orchestrator/orchestrator.rs +++ b/src/orchestrator/orchestrator.rs @@ -70,11 +70,11 @@ impl<'a> Orchestrator<'a> { pub async fn run(self) -> Result> { let mut report_result = vec![]; let scheduler = self.scheduler; // moved here because of partial-move semantics + let merged_store = MergedStores::new(self.release_store.clone(), self.staging_store.clone()); for jobset in self.jobsets.into_iter() { let mut results = Self::run_jobset(&scheduler, - self.release_store.clone(), - self.staging_store.clone(), + &merged_store, &self.source_cache, &self.config, jobset) @@ -88,8 +88,7 @@ impl<'a> Orchestrator<'a> { async fn run_jobset( scheduler: &EndpointScheduler, - release_store: Arc>, - staging_store: Arc>, + merged_store: &MergedStores, source_cache: &SourceCache, config: &Configuration, jobset: JobSet) @@ -97,7 +96,6 @@ impl<'a> Orchestrator<'a> { { use tokio::stream::StreamExt; - let merged_store = MergedStores::new(release_store, staging_store); let multibar = Arc::new(indicatif::MultiProgress::new()); let results = jobset // run the jobs in the set .into_runables(&merged_store, source_cache, config) -- cgit v1.2.3