diff --git a/meilisearch-http/src/data/mod.rs b/meilisearch-http/src/data/mod.rs index 60fb5ae20..e63bf9380 100644 --- a/meilisearch-http/src/data/mod.rs +++ b/meilisearch-http/src/data/mod.rs @@ -112,7 +112,6 @@ impl Data { Ok(self.index_controller.get_all_stats().await?) } - #[inline] pub fn http_payload_size_limit(&self) -> usize { self.options.http_payload_size_limit.get_bytes() as usize diff --git a/meilisearch-http/src/index_controller/index_actor/actor.rs b/meilisearch-http/src/index_controller/index_actor/actor.rs index ff7064600..e9e55606f 100644 --- a/meilisearch-http/src/index_controller/index_actor/actor.rs +++ b/meilisearch-http/src/index_controller/index_actor/actor.rs @@ -159,22 +159,16 @@ impl IndexActor { meta: Processing, data: File, ) -> Result { - let get_result = || async { - debug!("Processing update {}", meta.id()); - let update_handler = self.update_handler.clone(); - let index = match self.store.get(uuid).await? { - Some(index) => index, - None => self.store.create(uuid, None).await?, - }; - - spawn_blocking(move || update_handler.handle_update(meta, data, index)) - .await - .map_err(|e| IndexError::Error(e.into())) + debug!("Processing update {}", meta.id()); + let update_handler = self.update_handler.clone(); + let index = match self.store.get(uuid).await? { + Some(index) => index, + None => self.store.create(uuid, None).await?, }; - let result = get_result().await; - - result + spawn_blocking(move || update_handler.handle_update(meta, data, index)) + .await + .map_err(|e| IndexError::Error(e.into())) } async fn handle_settings(&self, uuid: Uuid) -> Result { diff --git a/meilisearch-http/src/index_controller/update_actor/mod.rs b/meilisearch-http/src/index_controller/update_actor/mod.rs index faeb140a6..6b7ed7b9b 100644 --- a/meilisearch-http/src/index_controller/update_actor/mod.rs +++ b/meilisearch-http/src/index_controller/update_actor/mod.rs @@ -37,7 +37,6 @@ pub struct UpdateStoreInfo { pub size: u64, /// Uuid of the currently processing update if it exists pub processing: Option, - } #[async_trait::async_trait] diff --git a/meilisearch-http/src/index_controller/update_actor/update_store.rs b/meilisearch-http/src/index_controller/update_actor/update_store.rs index 2e5350193..70f20e901 100644 --- a/meilisearch-http/src/index_controller/update_actor/update_store.rs +++ b/meilisearch-http/src/index_controller/update_actor/update_store.rs @@ -130,7 +130,7 @@ where // Init update loop to perform any pending updates at launch. // Since we just launched the update store, and we still own the receiving end of the - // channel, this call is guarenteed to succeed. + // channel, this call is guaranteed to succeed. notification_sender.try_send(()).expect("Failed to init update store"); let update_store = Arc::new(UpdateStore { @@ -339,20 +339,19 @@ where let pending = self .pending_meta .prefix_iter(&rtxn, index_uuid.as_bytes())? - .filter_map(Result::ok) - .filter_map(|(_, p)| { + .filter_map(|entry| { + let (_, p) = entry.ok()?; if let Some((uuid, ref processing)) = *processing { // Filter out the currently processing update if it is from this index. if uuid == index_uuid && processing.id() == p.id() { None } else { - Some(p) + Some(UpdateStatus::from(p)) } } else { - Some(p) + Some(UpdateStatus::from(p)) } - }) - .map(UpdateStatus::from); + }); updates.extend(pending);