mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-01-19 01:18:31 +08:00
make the analytics interval a const
This commit is contained in:
parent
de35a9a605
commit
9abd2aa9d7
@ -55,6 +55,7 @@ fn write_user_id(db_path: &Path, user_id: &str) {
|
|||||||
mod segment {
|
mod segment {
|
||||||
use crate::analytics::Analytics;
|
use crate::analytics::Analytics;
|
||||||
use crate::routes::indexes::documents::UpdateDocumentsQuery;
|
use crate::routes::indexes::documents::UpdateDocumentsQuery;
|
||||||
|
use crate::Opt;
|
||||||
use actix_web::http::header::USER_AGENT;
|
use actix_web::http::header::USER_AGENT;
|
||||||
use actix_web::HttpRequest;
|
use actix_web::HttpRequest;
|
||||||
use http::header::CONTENT_TYPE;
|
use http::header::CONTENT_TYPE;
|
||||||
@ -72,8 +73,6 @@ mod segment {
|
|||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
use crate::Opt;
|
|
||||||
|
|
||||||
const SEGMENT_API_KEY: &str = "vHi89WrNDckHSQssyUJqLvIyp2QFITSC";
|
const SEGMENT_API_KEY: &str = "vHi89WrNDckHSQssyUJqLvIyp2QFITSC";
|
||||||
|
|
||||||
pub fn extract_user_agents(request: &HttpRequest) -> Vec<String> {
|
pub fn extract_user_agents(request: &HttpRequest) -> Vec<String> {
|
||||||
@ -222,7 +221,8 @@ mod segment {
|
|||||||
}
|
}
|
||||||
let _ = batcher.flush().await;
|
let _ = batcher.flush().await;
|
||||||
}
|
}
|
||||||
tokio::time::sleep(Duration::from_secs(60 * 60)).await; // one hour
|
const INTERVAL: Duration = Duration::from_secs(60 * 60); // one hour
|
||||||
|
tokio::time::sleep(INTERVAL).await;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user