log the dump creation

This commit is contained in:
Irevoire 2021-10-14 11:32:55 +02:00 committed by marin postma
parent 8e2d6cf87d
commit 75d1272325
No known key found for this signature in database
GPG Key ID: 6088B7721C3E39F9

View File

@ -1,8 +1,10 @@
use actix_web::{web, HttpResponse}; use actix_web::{web, HttpRequest, HttpResponse};
use log::debug; use log::debug;
use meilisearch_lib::MeiliSearch; use meilisearch_lib::MeiliSearch;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_json::json;
use crate::analytics::Analytics;
use crate::error::ResponseError; use crate::error::ResponseError;
use crate::extractors::authentication::{policies::*, GuardedData}; use crate::extractors::authentication::{policies::*, GuardedData};
@ -13,7 +15,11 @@ pub fn configure(cfg: &mut web::ServiceConfig) {
pub async fn create_dump( pub async fn create_dump(
meilisearch: GuardedData<Private, MeiliSearch>, meilisearch: GuardedData<Private, MeiliSearch>,
req: HttpRequest,
analytics: web::Data<&'static dyn Analytics>,
) -> Result<HttpResponse, ResponseError> { ) -> Result<HttpResponse, ResponseError> {
analytics.publish("Dump Created".to_string(), json!({}), Some(&req));
let res = meilisearch.create_dump().await?; let res = meilisearch.create_dump().await?;
debug!("returns: {:?}", res); debug!("returns: {:?}", res);