From 13e01a6dc921d8b4cca13ddfe108f9818b5cef4c Mon Sep 17 00:00:00 2001 From: timedout Date: Tue, 13 Oct 2026 01:15:14 +0100 Subject: [PATCH] feat: Always run mutex assertion outside maxperf Also makes it not a panic --- src/service/rooms/timeline/create.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/service/rooms/timeline/create.rs b/src/service/rooms/timeline/create.rs index daa417b34..fd6f1019e 100644 --- a/src/service/rooms/timeline/create.rs +++ b/src/service/rooms/timeline/create.rs @@ -95,8 +95,18 @@ impl super::Service { redacts, timestamp, } = partial_pdu; - if state_key.is_some() { - debug_assert!(mutex_lock.is_some(), "No state mutex held while creating state event"); + #[cfg(not(feature = "release_max_log_level"))] + if state_key.is_some() && mutex_lock.is_none() { + return Err!(error!( + ?event_type, + ?content, + ?sticky, + ?unsigned, + ?state_key, + ?redacts, + ?timestamp, + "Attempted to build a state event without a state mutex lock" + )); } trace!(