Skip to content

Commit 7b73311

Browse files
committed
feat(sqlite): Add logs around read and write.
1 parent f03934b commit 7b73311

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ use tokio::{
4747
fs,
4848
sync::{Mutex, OwnedMutexGuard},
4949
};
50-
use tracing::{debug, error, trace};
50+
use tracing::{debug, error, instrument, trace};
5151

5252
use crate::{
5353
error::{Error, Result},
@@ -173,9 +173,14 @@ impl SqliteEventCacheStore {
173173
}
174174

175175
// Acquire a connection for executing read operations.
176+
#[instrument(skip_all)]
176177
async fn read(&self) -> Result<SqliteAsyncConn> {
178+
trace!("Taking a `read` connection");
179+
177180
let connection = self.pool.get().await?;
178181

182+
trace!("`read` connection taken");
183+
179184
// Per https://www.sqlite.org/foreignkeys.html#fk_enable, foreign key
180185
// support must be enabled on a per-connection basis. Execute it every
181186
// time we try to get a connection, since we can't guarantee a previous
@@ -186,9 +191,14 @@ impl SqliteEventCacheStore {
186191
}
187192

188193
// Acquire a connection for executing write operations.
194+
#[instrument(skip_all)]
189195
async fn write(&self) -> Result<OwnedMutexGuard<SqliteAsyncConn>> {
196+
trace!("Taking a `write` connection");
197+
190198
let connection = self.write_connection.clone().lock_owned().await;
191199

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

0 commit comments

Comments
 (0)