mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-23 10:37:41 +08:00
Remove last_update from stats
This commit is contained in:
parent
3286a5213c
commit
1b8df0ed8b
@ -312,7 +312,7 @@ pub fn index_update_callback(index_uid: &str, data: &Data, _status: ProcessedUpd
|
|||||||
let mut writer = env.write_txn().unwrap();
|
let mut writer = env.write_txn().unwrap();
|
||||||
|
|
||||||
data.compute_stats(&mut writer, &index_uid).unwrap();
|
data.compute_stats(&mut writer, &index_uid).unwrap();
|
||||||
data.set_last_update(&mut writer, &index_uid).unwrap();
|
data.set_last_update(&mut writer).unwrap();
|
||||||
|
|
||||||
writer.commit().unwrap();
|
writer.commit().unwrap();
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use chrono::{DateTime, Utc};
|
|
||||||
use pretty_bytes::converter::convert;
|
use pretty_bytes::converter::convert;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use sysinfo::{NetworkExt, Pid, ProcessExt, ProcessorExt, System, SystemExt};
|
use sysinfo::{NetworkExt, Pid, ProcessExt, ProcessorExt, System, SystemExt};
|
||||||
@ -17,7 +15,6 @@ use crate::Data;
|
|||||||
struct IndexStatsResponse {
|
struct IndexStatsResponse {
|
||||||
number_of_documents: u64,
|
number_of_documents: u64,
|
||||||
is_indexing: bool,
|
is_indexing: bool,
|
||||||
last_update: Option<DateTime<Utc>>,
|
|
||||||
fields_frequency: HashMap<String, usize>,
|
fields_frequency: HashMap<String, usize>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,9 +31,9 @@ pub async fn index_stat(ctx: Context<Data>) -> SResult<Response> {
|
|||||||
.number_of_documents(&reader)
|
.number_of_documents(&reader)
|
||||||
.map_err(ResponseError::internal)?;
|
.map_err(ResponseError::internal)?;
|
||||||
|
|
||||||
let fields_frequency = ctx
|
let fields_frequency = index
|
||||||
.state()
|
.main
|
||||||
.fields_frequency(&reader, &index_uid)
|
.fields_frequency(&reader)
|
||||||
.map_err(ResponseError::internal)?
|
.map_err(ResponseError::internal)?
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
|
||||||
@ -46,15 +43,9 @@ pub async fn index_stat(ctx: Context<Data>) -> SResult<Response> {
|
|||||||
.map_err(ResponseError::internal)?
|
.map_err(ResponseError::internal)?
|
||||||
.ok_or(ResponseError::not_found("Index not found"))?;
|
.ok_or(ResponseError::not_found("Index not found"))?;
|
||||||
|
|
||||||
let last_update = ctx
|
|
||||||
.state()
|
|
||||||
.last_update(&reader, &index_uid)
|
|
||||||
.map_err(ResponseError::internal)?;
|
|
||||||
|
|
||||||
let response = IndexStatsResponse {
|
let response = IndexStatsResponse {
|
||||||
number_of_documents,
|
number_of_documents,
|
||||||
is_indexing,
|
is_indexing,
|
||||||
last_update,
|
|
||||||
fields_frequency,
|
fields_frequency,
|
||||||
};
|
};
|
||||||
Ok(tide::response::json(response))
|
Ok(tide::response::json(response))
|
||||||
@ -85,9 +76,9 @@ pub async fn get_stats(ctx: Context<Data>) -> SResult<Response> {
|
|||||||
.number_of_documents(&reader)
|
.number_of_documents(&reader)
|
||||||
.map_err(ResponseError::internal)?;
|
.map_err(ResponseError::internal)?;
|
||||||
|
|
||||||
let fields_frequency = ctx
|
let fields_frequency = index
|
||||||
.state()
|
.main
|
||||||
.fields_frequency(&reader, &index_uid)
|
.fields_frequency(&reader)
|
||||||
.map_err(ResponseError::internal)?
|
.map_err(ResponseError::internal)?
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
|
||||||
@ -97,15 +88,9 @@ pub async fn get_stats(ctx: Context<Data>) -> SResult<Response> {
|
|||||||
.map_err(ResponseError::internal)?
|
.map_err(ResponseError::internal)?
|
||||||
.ok_or(ResponseError::not_found("Index not found"))?;
|
.ok_or(ResponseError::not_found("Index not found"))?;
|
||||||
|
|
||||||
let last_update = ctx
|
|
||||||
.state()
|
|
||||||
.last_update(&reader, &index_uid)
|
|
||||||
.map_err(ResponseError::internal)?;
|
|
||||||
|
|
||||||
let response = IndexStatsResponse {
|
let response = IndexStatsResponse {
|
||||||
number_of_documents,
|
number_of_documents,
|
||||||
is_indexing,
|
is_indexing,
|
||||||
last_update,
|
|
||||||
fields_frequency,
|
fields_frequency,
|
||||||
};
|
};
|
||||||
index_list.insert(index_uid, response);
|
index_list.insert(index_uid, response);
|
||||||
|
Loading…
Reference in New Issue
Block a user