diff --git a/meilisearch/Cargo.toml b/meilisearch/Cargo.toml index 1f51cea84..72c6e27e1 100644 --- a/meilisearch/Cargo.toml +++ b/meilisearch/Cargo.toml @@ -68,7 +68,7 @@ pin-project-lite = "0.2.9" platform-dirs = "0.3.0" prometheus = { version = "0.13.3", features = ["process"] } puffin = "0.16.0" -puffin_http = "0.13.0" +puffin_http = { version = "0.13.0", optional = true } rand = "0.8.5" rayon = "1.7.0" regex = "1.7.3" @@ -135,6 +135,7 @@ zip = { version = "0.6.4", optional = true } [features] default = ["analytics", "meilisearch-types/all-tokenizations", "mini-dashboard"] analytics = ["segment"] +profile-with-puffin = ["dep:puffin_http"] mini-dashboard = [ "actix-web-static-files", "static-files", diff --git a/meilisearch/src/main.rs b/meilisearch/src/main.rs index 5189113ad..3ae3d27cb 100644 --- a/meilisearch/src/main.rs +++ b/meilisearch/src/main.rs @@ -29,8 +29,9 @@ fn setup(opt: &Opt) -> anyhow::Result<()> { async fn main() -> anyhow::Result<()> { let (opt, config_read_from) = Opt::try_build()?; - puffin::set_scopes_on(true); + #[cfg(feature = "profile-with-puffin")] let _server = puffin_http::Server::new(&format!("0.0.0.0:{}", puffin_http::DEFAULT_PORT))?; + puffin::set_scopes_on(cfg!(feature = "profile-with-puffin")); anyhow::ensure!( !(cfg!(windows) && opt.experimental_reduce_indexing_memory_usage),