From 2f671f196e245ac1a791c001286e401a2fab9d3a Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Mon, 20 Jul 2026 23:00:06 +0200 Subject: chore: Commit --- crates/daemon/src/api/history.rs | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) (limited to 'crates/daemon/src/api/history.rs') diff --git a/crates/daemon/src/api/history.rs b/crates/daemon/src/api/history.rs index bcd2ee5a..d024ea92 100644 --- a/crates/daemon/src/api/history.rs +++ b/crates/daemon/src/api/history.rs @@ -8,11 +8,7 @@ use tonic::{Request, Response, Status}; use tracing::{Level, instrument}; use crate::{ - aclient::{ - database::{ClientSqlite, current_context}, - history::store::HistoryStore, - settings::Settings, - }, + aclient::{history::store::HistoryStore, settings::Settings}, daemon::DaemonHandle, events::DaemonEvent, }; @@ -41,12 +37,10 @@ pub(crate) struct HistoryService { /// History store for pushing records history_store: HistoryStore, - - history_db: ClientSqlite, } impl HistoryService { - pub(crate) async fn new(handle: DaemonHandle, history_db: ClientSqlite) -> Result { + pub(crate) async fn new(handle: DaemonHandle) -> Result { let host_id = Settings::host_id().await?; let history_store = HistoryStore::new(handle.store().clone(), host_id, *handle.encryption_key()); @@ -55,7 +49,6 @@ impl HistoryService { running: DashMap::new(), handle, history_store, - history_db, }) } @@ -91,18 +84,15 @@ impl HistorySvc for HistoryService { ) -> Result, Status> { let req = request.into_inner(); - let context = current_context(req.session) - .await - .map_err(|e| Status::internal(format!("failed to aquire context: {e:?}")))?; - let entries = if let Some(range) = req.range { let from = OffsetDateTime::from_unix_timestamp(range.start as i64).unwrap(); let to = OffsetDateTime::from_unix_timestamp(range.end as i64).unwrap(); - self.history_db.range(from, to).await + self.handle.history_db().range(from, to).await } else { - self.history_db - .list(&[], &context, None, false, false) + self.handle + .history_db() + .list(None, None, false, false) .await } .map_err(|e| Status::internal(format!("failed to read db: {e:?}")))? @@ -203,7 +193,6 @@ impl HistorySvc for HistoryService { } #[instrument(skip_all, level = Level::INFO)] - #[expect(clippy::significant_drop_tightening, reason = "Would be a logic-bug")] async fn tail_history( &self, _request: Request, -- cgit v1.3.1