Skip to content

Commit 2d83d30

Browse files
committed
feat(sqlite): Add timer! tracings in read and write's EventCacheStore.
1 parent 2840bdd commit 2d83d30

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

crates/matrix-sdk-sqlite/src/event_cache_store.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ use matrix_sdk_base::{
3636
Position, RawChunk, Update,
3737
},
3838
media::{MediaRequestParameters, UniqueKey},
39+
timer,
3940
};
4041
use matrix_sdk_store_encryption::StoreCipher;
4142
use ruma::{
@@ -176,11 +177,10 @@ impl SqliteEventCacheStore {
176177
#[instrument(skip_all)]
177178
async fn read(&self) -> Result<SqliteAsyncConn> {
178179
trace!("Taking a `read` connection");
180+
let _ = timer!("`read` connection acquired");
179181

180182
let connection = self.pool.get().await?;
181183

182-
trace!("`read` connection taken");
183-
184184
// Per https://www.sqlite.org/foreignkeys.html#fk_enable, foreign key
185185
// support must be enabled on a per-connection basis. Execute it every
186186
// time we try to get a connection, since we can't guarantee a previous
@@ -194,11 +194,10 @@ impl SqliteEventCacheStore {
194194
#[instrument(skip_all)]
195195
async fn write(&self) -> Result<OwnedMutexGuard<SqliteAsyncConn>> {
196196
trace!("Taking a `write` connection");
197+
let _ = timer!("`write` connection acquired");
197198

198199
let connection = self.write_connection.clone().lock_owned().await;
199200

200-
trace!("`write` connection taken");
201-
202201
// Per https://www.sqlite.org/foreignkeys.html#fk_enable, foreign key
203202
// support must be enabled on a per-connection basis. Execute it every
204203
// time we try to get a connection, since we can't guarantee a previous

0 commit comments

Comments
 (0)