mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-27 15:10:05 +01:00
review fixes
This commit is contained in:
parent
c78f351300
commit
51829ad85e
@ -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
|
||||
|
@ -159,22 +159,16 @@ impl<S: IndexStore + Sync + Send> IndexActor<S> {
|
||||
meta: Processing<UpdateMeta>,
|
||||
data: File,
|
||||
) -> Result<UpdateResult> {
|
||||
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<Settings> {
|
||||
|
@ -37,7 +37,6 @@ pub struct UpdateStoreInfo {
|
||||
pub size: u64,
|
||||
/// Uuid of the currently processing update if it exists
|
||||
pub processing: Option<Uuid>,
|
||||
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user