mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-25 11:35:05 +08:00
simplify the search batcher
This commit is contained in:
parent
6591acfdfa
commit
f9b14ca149
@ -205,7 +205,7 @@ mod segment {
|
||||
|
||||
fn start_search(
|
||||
&'static self,
|
||||
getter: impl Fn(&'static Self) -> &'static Mutex<SearchBatcher> + Send + Sync + 'static,
|
||||
batcher: &'static Mutex<SearchBatcher>,
|
||||
query: &SearchQuery,
|
||||
request: &HttpRequest,
|
||||
) {
|
||||
@ -262,7 +262,7 @@ mod segment {
|
||||
- 1;
|
||||
|
||||
println!("Batching a search");
|
||||
let mut search_batcher = getter(self).lock().await;
|
||||
let mut search_batcher = batcher.lock().await;
|
||||
user_agent.into_iter().for_each(|ua| {
|
||||
search_batcher.user_agents.insert(ua);
|
||||
});
|
||||
@ -347,7 +347,7 @@ mod segment {
|
||||
}
|
||||
|
||||
fn start_get_search(&'static self, query: &SearchQuery, request: &HttpRequest) {
|
||||
self.start_search(|s| &s.get_search_batcher, query, request)
|
||||
self.start_search(&self.get_search_batcher, query, request)
|
||||
}
|
||||
|
||||
fn end_get_search(&'static self, process_time: usize) {
|
||||
@ -359,7 +359,7 @@ mod segment {
|
||||
}
|
||||
|
||||
fn start_post_search(&'static self, query: &SearchQuery, request: &HttpRequest) {
|
||||
self.start_search(|s| &s.post_search_batcher, query, request)
|
||||
self.start_search(&self.post_search_batcher, query, request)
|
||||
}
|
||||
|
||||
fn end_post_search(&'static self, process_time: usize) {
|
||||
@ -500,7 +500,7 @@ mod segment {
|
||||
}
|
||||
|
||||
impl DocumentsBatcher {
|
||||
pub fn into_event(mut self, user: &User, event_name: &str) -> Option<Track> {
|
||||
pub fn into_event(self, user: &User, event_name: &str) -> Option<Track> {
|
||||
if self.updated {
|
||||
None
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user