Skip to content

feat(sqlite): SqliteEventCacheStore has 1 write connection #5382

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
14 changes: 5 additions & 9 deletions crates/matrix-sdk-common/src/tracing_timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl std::fmt::Debug for TracingTimer {

impl Drop for TracingTimer {
fn drop(&mut self) {
let message = format!("{} finished in {}ms", self.id, self.start.elapsed().as_millis());
let message = format!("_{}_ finished in {:?}", self.id, self.start.elapsed());

let enabled = tracing::level_enabled!(self.level) && {
let interest = self.callsite.interest();
Expand Down Expand Up @@ -62,12 +62,8 @@ impl Drop for TracingTimer {
}

impl TracingTimer {
/// Create a new `TracingTimer` at the `debug` log level.
pub fn new_debug(
callsite: &'static DefaultCallsite,
id: String,
level: tracing::Level,
) -> Self {
/// Create a new `TracingTimer`.
pub fn new(callsite: &'static DefaultCallsite, id: String, level: tracing::Level) -> Self {
Self { id, callsite, start: Instant::now(), level }
}
}
Expand Down Expand Up @@ -111,7 +107,7 @@ macro_rules! timer {
fields: []
};

$crate::tracing_timer::TracingTimer::new_debug(&__CALLSITE, $string.into(), $level)
$crate::tracing_timer::TracingTimer::new(&__CALLSITE, $string.into(), $level)
}};

($string:expr) => {
Expand All @@ -133,7 +129,7 @@ mod tests {
let _timer_guard = timer!(tracing::Level::DEBUG, "test");
tokio::time::sleep(ruma::time::Duration::from_millis(123)).await;
// Displays: 2023-08-25T15:18:31.169498Z DEBUG
// matrix_sdk_common::tracing_timer::tests: test finished in
// matrix_sdk_common::tracing_timer::tests: _test_ finished in
// 124ms
}
}
Expand Down
Loading
Loading