From 07f13f5ce94f03ad9b4207a96af970d64d9d3726 Mon Sep 17 00:00:00 2001 From: boxbeam Date: Tue, 26 Mar 2024 17:51:08 -0400 Subject: [PATCH] fix(tabby): Do not log events to db if --webserver is not specified (#1733) --- crates/tabby/src/serve.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/crates/tabby/src/serve.rs b/crates/tabby/src/serve.rs index 4b2ccaf5f235..2471041cbcb8 100644 --- a/crates/tabby/src/serve.rs +++ b/crates/tabby/src/serve.rs @@ -25,6 +25,7 @@ use crate::{ chat::create_chat_service, code::create_code_search, completion::{self, create_completion_service}, + event::create_logger, health, model::download_model_if_needed, }, @@ -121,16 +122,23 @@ pub async fn main(config: &Config, args: &ServeArgs) { info!("Starting server, this might take a few minutes..."); #[cfg(feature = "ee")] - let ws = tabby_webserver::public::WebserverHandle::new().await; + let ws = if args.webserver { + Some(tabby_webserver::public::WebserverHandle::new().await) + } else { + None + }; let logger: Arc; #[cfg(feature = "ee")] { - logger = ws.logger(); + logger = ws + .as_ref() + .map(|ws| ws.logger()) + .unwrap_or_else(|| Arc::new(create_logger())); } #[cfg(not(feature = "ee"))] { - logger = Arc::new(crate::services::event::create_logger()); + logger = Arc::new(create_logger()); } let code = Arc::new(create_code_search()); @@ -141,6 +149,7 @@ pub async fn main(config: &Config, args: &ServeArgs) { #[cfg(feature = "ee")] let (api, ui) = if args.webserver { let (api, ui) = ws + .unwrap() .attach_webserver(api, ui, code, args.chat_model.is_some(), args.port) .await; (api, ui)