review fixes

This commit is contained in:
Marin Postma 2021-04-19 09:47:43 +02:00
parent c78f351300
commit 51829ad85e
No known key found for this signature in database
GPG Key ID: D5241F0C0C865F30
4 changed files with 14 additions and 23 deletions

View File

@ -112,7 +112,6 @@ impl Data {
Ok(self.index_controller.get_all_stats().await?) Ok(self.index_controller.get_all_stats().await?)
} }
#[inline] #[inline]
pub fn http_payload_size_limit(&self) -> usize { pub fn http_payload_size_limit(&self) -> usize {
self.options.http_payload_size_limit.get_bytes() as usize self.options.http_payload_size_limit.get_bytes() as usize

View File

@ -159,7 +159,6 @@ impl<S: IndexStore + Sync + Send> IndexActor<S> {
meta: Processing<UpdateMeta>, meta: Processing<UpdateMeta>,
data: File, data: File,
) -> Result<UpdateResult> { ) -> Result<UpdateResult> {
let get_result = || async {
debug!("Processing update {}", meta.id()); debug!("Processing update {}", meta.id());
let update_handler = self.update_handler.clone(); let update_handler = self.update_handler.clone();
let index = match self.store.get(uuid).await? { let index = match self.store.get(uuid).await? {
@ -170,11 +169,6 @@ impl<S: IndexStore + Sync + Send> IndexActor<S> {
spawn_blocking(move || update_handler.handle_update(meta, data, index)) spawn_blocking(move || update_handler.handle_update(meta, data, index))
.await .await
.map_err(|e| IndexError::Error(e.into())) .map_err(|e| IndexError::Error(e.into()))
};
let result = get_result().await;
result
} }
async fn handle_settings(&self, uuid: Uuid) -> Result<Settings> { async fn handle_settings(&self, uuid: Uuid) -> Result<Settings> {

View File

@ -37,7 +37,6 @@ pub struct UpdateStoreInfo {
pub size: u64, pub size: u64,
/// Uuid of the currently processing update if it exists /// Uuid of the currently processing update if it exists
pub processing: Option<Uuid>, pub processing: Option<Uuid>,
} }
#[async_trait::async_trait] #[async_trait::async_trait]

View File

@ -130,7 +130,7 @@ where
// Init update loop to perform any pending updates at launch. // 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 // 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"); notification_sender.try_send(()).expect("Failed to init update store");
let update_store = Arc::new(UpdateStore { let update_store = Arc::new(UpdateStore {
@ -339,20 +339,19 @@ where
let pending = self let pending = self
.pending_meta .pending_meta
.prefix_iter(&rtxn, index_uuid.as_bytes())? .prefix_iter(&rtxn, index_uuid.as_bytes())?
.filter_map(Result::ok) .filter_map(|entry| {
.filter_map(|(_, p)| { let (_, p) = entry.ok()?;
if let Some((uuid, ref processing)) = *processing { if let Some((uuid, ref processing)) = *processing {
// Filter out the currently processing update if it is from this index. // Filter out the currently processing update if it is from this index.
if uuid == index_uuid && processing.id() == p.id() { if uuid == index_uuid && processing.id() == p.id() {
None None
} else { } else {
Some(p) Some(UpdateStatus::from(p))
} }
} else { } else {
Some(p) Some(UpdateStatus::from(p))
} }
}) });
.map(UpdateStatus::from);
updates.extend(pending); updates.extend(pending);