remove all the debug prints

This commit is contained in:
Tamo 2021-10-26 13:20:54 +02:00 committed by marin postma
parent 3144b572c4
commit 01737ef847
No known key found for this signature in database
GPG Key ID: 6088B7721C3E39F9

View File

@ -40,7 +40,6 @@ fn write_user_id(db_path: &Path, user_id: &str) {
.as_ref() .as_ref()
.zip(config_user_id_path(db_path)) .zip(config_user_id_path(db_path))
{ {
println!("{}", user_id_path.display());
let _ = fs::create_dir_all(&meilisearch_config_path); let _ = fs::create_dir_all(&meilisearch_config_path);
let _ = fs::write(user_id_path, user_id.as_bytes()); let _ = fs::write(user_id_path, user_id.as_bytes());
} }
@ -182,7 +181,6 @@ mod segment {
if let Ok(stats) = meilisearch.get_all_stats().await { if let Ok(stats) = meilisearch.get_all_stats().await {
let traits = Self::compute_traits(&self.opt, stats); let traits = Self::compute_traits(&self.opt, stats);
let user = self.user.clone(); let user = self.user.clone();
println!("ANALYTICS: Pushing our identify tick");
let _ = self let _ = self
.batcher .batcher
.lock() .lock()
@ -199,12 +197,10 @@ mod segment {
}) })
.await; .await;
} }
println!("ANALYTICS: taking the lock on the search batchers");
let get_search = std::mem::take(&mut *self.get_search_batcher.lock().await) let get_search = std::mem::take(&mut *self.get_search_batcher.lock().await)
.into_event(&self.user, "Document Searched GET"); .into_event(&self.user, "Document Searched GET");
let post_search = std::mem::take(&mut *self.post_search_batcher.lock().await) let post_search = std::mem::take(&mut *self.post_search_batcher.lock().await)
.into_event(&self.user, "Document Searched POST"); .into_event(&self.user, "Document Searched POST");
println!("ANALYTICS: taking the lock on the documents batchers");
let add_documents = let add_documents =
std::mem::take(&mut *self.add_documents_batcher.lock().await) std::mem::take(&mut *self.add_documents_batcher.lock().await)
.into_event(&self.user, "Documents Added"); .into_event(&self.user, "Documents Added");
@ -213,7 +209,6 @@ mod segment {
.into_event(&self.user, "Documents Updated"); .into_event(&self.user, "Documents Updated");
// keep the lock on the batcher just for these three operations // keep the lock on the batcher just for these three operations
{ {
println!("ANALYTICS: taking the lock on the batchers");
let mut batcher = self.batcher.lock().await; let mut batcher = self.batcher.lock().await;
if let Some(get_search) = get_search { if let Some(get_search) = get_search {
let _ = batcher.push(get_search).await; let _ = batcher.push(get_search).await;
@ -227,10 +222,8 @@ mod segment {
if let Some(update_documents) = update_documents { if let Some(update_documents) = update_documents {
let _ = batcher.push(update_documents).await; let _ = batcher.push(update_documents).await;
} }
println!("ANALYTICS: Sending the batch");
let _ = batcher.flush().await; let _ = batcher.flush().await;
} }
println!("ANALYTICS: sent the batch");
tokio::time::sleep(Duration::from_secs(60 * 2)).await; // 2 minutes tokio::time::sleep(Duration::from_secs(60 * 2)).await; // 2 minutes
} }
}); });
@ -294,7 +287,6 @@ mod segment {
.count() .count()
- 1; - 1;
println!("Batching a search");
let mut search_batcher = batcher.lock().await; let mut search_batcher = batcher.lock().await;
user_agent.into_iter().for_each(|ua| { user_agent.into_iter().for_each(|ua| {
search_batcher.user_agents.insert(ua); search_batcher.user_agents.insert(ua);
@ -362,7 +354,6 @@ mod segment {
.map(|header| header.to_str().unwrap_or("unknown").to_string()); .map(|header| header.to_str().unwrap_or("unknown").to_string());
tokio::spawn(async move { tokio::spawn(async move {
println!("ANALYTICS pushing {} in the batcher", event_name);
let _ = self let _ = self
.batcher .batcher
.lock() .lock()
@ -375,7 +366,6 @@ mod segment {
..Default::default() ..Default::default()
}) })
.await; .await;
println!("ANALYTICS {} pushed", event_name);
}); });
} }