From e6ab243dfde79c50ce5661b630ed26b9a1504dae Mon Sep 17 00:00:00 2001 From: Michelle Tilley Date: Thu, 5 Mar 2026 08:36:31 -0800 Subject: feat: Allow setting multipliers for frequency, recency, and frecency scores (#3235) --- crates/atuin-daemon/src/lib.rs | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'crates/atuin-daemon/src/lib.rs') diff --git a/crates/atuin-daemon/src/lib.rs b/crates/atuin-daemon/src/lib.rs index 6dc04db3..84f808e4 100644 --- a/crates/atuin-daemon/src/lib.rs +++ b/crates/atuin-daemon/src/lib.rs @@ -1,5 +1,6 @@ use atuin_client::database::Sqlite as HistoryDatabase; -use atuin_client::{record::sqlite_store::SqliteStore, settings::Settings}; +use atuin_client::record::sqlite_store::SqliteStore; +use atuin_client::settings::{Settings, watcher::global_settings_watcher}; use eyre::Result; pub mod client; @@ -59,6 +60,26 @@ pub async fn boot( // Start all components first (so gRPC services can work) daemon.start_components().await?; + // Spawn config file watcher to reload settings on changes + if let Ok(watcher) = global_settings_watcher() { + let mut settings_rx = watcher.subscribe(); + let watcher_handle = handle.clone(); + tokio::spawn(async move { + tracing::info!("config file watcher started"); + while settings_rx.changed().await.is_ok() { + // Use the already-loaded settings from the watcher + // (avoids parsing the config file twice) + let new_settings = (*settings_rx.borrow()).clone(); + watcher_handle.apply_settings((*new_settings).clone()).await; + } + tracing::debug!("config file watcher stopped"); + }); + } else { + tracing::warn!( + "failed to start config file watcher; settings changes will require daemon restart" + ); + } + // Spawn signal handler to emit ShutdownRequested on Ctrl+C/SIGTERM let signal_handle = handle.clone(); tokio::spawn(async move { -- cgit v1.3.1