diff --git a/meilisearch-lib/src/index_controller/update_file_store.rs b/meilisearch-lib/src/index_controller/update_file_store.rs index df4014e05..fed5fe200 100644 --- a/meilisearch-lib/src/index_controller/update_file_store.rs +++ b/meilisearch-lib/src/index_controller/update_file_store.rs @@ -159,4 +159,8 @@ impl UpdateFileStore { Ok(()) } + + pub fn get_size(&self, uuid: Uuid) -> Result { + Ok(self.get_update(uuid)?.metadata()?.len()) + } } diff --git a/meilisearch-lib/src/index_controller/updates/store/mod.rs b/meilisearch-lib/src/index_controller/updates/store/mod.rs index 06577985c..46786f1ac 100644 --- a/meilisearch-lib/src/index_controller/updates/store/mod.rs +++ b/meilisearch-lib/src/index_controller/updates/store/mod.rs @@ -535,24 +535,27 @@ impl UpdateStore { } let path = path.as_ref().to_owned(); - indexes.par_iter().try_for_each(|index| index.snapshot(&path)).unwrap(); + indexes.par_iter().try_for_each(|index| index.snapshot(path.clone())).unwrap(); Ok(()) } pub fn get_info(&self) -> Result { - let size = self.env.size(); + let mut size = self.env.size(); let txn = self.env.read_txn()?; for entry in self.pending_queue.iter(&txn)? { - let (_, _pending) = entry?; - //if let Enqueued { - //content: Some(uuid), - //.. - //} = pending - //{ - //let path = update_uuid_to_file_path(&self.path, uuid); - //size += File::open(path)?.metadata()?.len(); - //} + let (_, pending) = entry?; + if let Enqueued { + meta: store::Update::DocumentAddition { + content_uuid, + .. + }, + .. + } = pending + { + let len = self.update_file_store.get_size(content_uuid)?; + size += len; + } } let processing = match *self.state.read() { State::Processing(uuid, _) => Some(uuid),