From d2c6a831756de179fd728ddfbda2e19bcadcc63f Mon Sep 17 00:00:00 2001 From: Benjamin Bouvier Date: Tue, 16 Jul 2024 17:01:56 +0200 Subject: [PATCH] sliding sync: only emit the recency_timestamp notable update if it's changed value --- crates/matrix-sdk-base/src/sliding_sync.rs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/crates/matrix-sdk-base/src/sliding_sync.rs b/crates/matrix-sdk-base/src/sliding_sync.rs index 4f29c5430..1b189f93e 100644 --- a/crates/matrix-sdk-base/src/sliding_sync.rs +++ b/crates/matrix-sdk-base/src/sliding_sync.rs @@ -766,16 +766,18 @@ fn process_room_properties( } if let Some(recency_timestamp) = &room_data.timestamp { - room_info.update_recency_timestamp(*recency_timestamp); + if room_info.recency_timestamp.as_ref() != Some(recency_timestamp) { + room_info.update_recency_timestamp(*recency_timestamp); - // If it's not a new room, let's emit a `RECENCY_TIMESTAMP` update. - // For a new room, the room will appear as new, so we don't care about this - // update. - if !is_new_room { - room_info_notable_updates - .entry(room_id.to_owned()) - .or_default() - .insert(RoomInfoNotableUpdateReasons::RECENCY_TIMESTAMP); + // If it's not a new room, let's emit a `RECENCY_TIMESTAMP` update. + // For a new room, the room will appear as new, so we don't care about this + // update. + if !is_new_room { + room_info_notable_updates + .entry(room_id.to_owned()) + .or_default() + .insert(RoomInfoNotableUpdateReasons::RECENCY_TIMESTAMP); + } } } }