Skip to content

Commit

Permalink
day dividers: demote an assert to an error message
Browse files Browse the repository at this point in the history
Because of the task cancellation that can happen at any place in the
code base, it's really hard to predict in which situation a
day-divider-adjuster should have run or not, so just demote the assert
to an error. The intent is that, if we see errors with day dividers in
the future, they'll be reported along rageshakes and we'll notice this
in the logs.
  • Loading branch information
bnjbvr committed Jun 6, 2024
1 parent 66330a2 commit a21ea06
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/matrix-sdk-ui/src/timeline/day_dividers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ pub(super) struct DayDividerAdjuster {
impl Drop for DayDividerAdjuster {
fn drop(&mut self) {
// Only run the assert if we're not currently panicking.
if !std::thread::panicking() {
assert!(self.consumed, "the DayDividerAdjuster must be consumed with run()");
if !std::thread::panicking() && !self.consumed {
error!("a DayDividerAdjuster has not been consumed with run()");
}
}
}
Expand Down

0 comments on commit a21ea06

Please sign in to comment.