From 6805cdd97b7e8aa2931cb7eb23d0f91d60441760 Mon Sep 17 00:00:00 2001 From: Kyler Chin <7539174+kylerchin@users.noreply.github.com> Date: Wed, 27 Mar 2024 02:14:59 -0700 Subject: [PATCH] Fix lifetime of unzip feeds --- src/maple/main.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/maple/main.rs b/src/maple/main.rs index 31c4f377..fdcdf5cc 100644 --- a/src/maple/main.rs +++ b/src/maple/main.rs @@ -297,14 +297,16 @@ async fn run_ingest() -> Result<(), Box> { let attempt_ids = Arc::new(attempt_ids); - for (feed_id, _) in unzip_feeds - .iter() + let unzip_feeds_clone = unzip_feeds.clone(); + + for (feed_id, _) in unzip_feeds_clone + .into_iter() .filter(|unzipped_feed| unzipped_feed.1 == true) { let attempt_ids = Arc::clone(&attempt_ids); - let attempt_id = attempt_ids.get(feed_id).unwrap().clone(); - if let Some(chateau_id) = feed_id_to_chateau_lookup.get(feed_id) { + let attempt_id = attempt_ids.get(&feed_id).unwrap().clone(); + if let Some(chateau_id) = feed_id_to_chateau_lookup.get(&feed_id) { let chateau_id = chateau_id.clone(); rt.spawn( @@ -316,7 +318,7 @@ async fn run_ingest() -> Result<(), Box> { let conn_pre = conn_pool.get().await; let conn = &mut conn_pre.unwrap(); - let this_download_data = download_feed_info_hashmap.get(feed_id).unwrap(); + let this_download_data = download_feed_info_hashmap.get(&feed_id).unwrap(); // call function to process GTFS feed, accepting feed_id, diesel pool args, chateau_id, attempt_id