From a79e9130e6500912cce4c329e706c75bdb92f91c Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Sun, 13 Jul 2025 08:36:14 +0200 Subject: [PATCH] feat(sqlite): Add `timer!` tracings in `read` and `write`'s `SqliteEventCacheStore`. --- crates/matrix-sdk-sqlite/src/event_cache_store.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/crates/matrix-sdk-sqlite/src/event_cache_store.rs b/crates/matrix-sdk-sqlite/src/event_cache_store.rs index 64503571e..d832c8a39 100644 --- a/crates/matrix-sdk-sqlite/src/event_cache_store.rs +++ b/crates/matrix-sdk-sqlite/src/event_cache_store.rs @@ -36,6 +36,7 @@ use matrix_sdk_base::{ Position, RawChunk, Update, }, media::{MediaRequestParameters, UniqueKey}, + timer, }; use matrix_sdk_store_encryption::StoreCipher; use ruma::{ @@ -176,11 +177,10 @@ impl SqliteEventCacheStore { #[instrument(skip_all)] async fn read(&self) -> Result { trace!("Taking a `read` connection"); + let _timer = timer!("connection"); let connection = self.pool.get().await?; - trace!("`read` connection taken"); - // Per https://www.sqlite.org/foreignkeys.html#fk_enable, foreign key // support must be enabled on a per-connection basis. Execute it every // time we try to get a connection, since we can't guarantee a previous @@ -194,11 +194,10 @@ impl SqliteEventCacheStore { #[instrument(skip_all)] async fn write(&self) -> Result> { trace!("Taking a `write` connection"); + let _timer = timer!("connection"); let connection = self.write_connection.clone().lock_owned().await; - trace!("`write` connection taken"); - // Per https://www.sqlite.org/foreignkeys.html#fk_enable, foreign key // support must be enabled on a per-connection basis. Execute it every // time we try to get a connection, since we can't guarantee a previous