feat: compute and cache RoomInfo::active_service_members#6537
Open
jmartinesp wants to merge 13 commits intomainfrom
Open
feat: compute and cache RoomInfo::active_service_members#6537jmartinesp wants to merge 13 commits intomainfrom
RoomInfo::active_service_members#6537jmartinesp wants to merge 13 commits intomainfrom
Conversation
45f313e to
88a8cc5
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #6537 +/- ##
==========================================
- Coverage 89.91% 89.91% -0.01%
==========================================
Files 381 381
Lines 105914 106006 +92
Branches 105914 106006 +92
==========================================
+ Hits 95237 95315 +78
- Misses 7028 7038 +10
- Partials 3649 3653 +4 ☔ View full report in Codecov by Sentry. |
This will be used as a cache for the computed value.
…active_service_members` The function will now store the computed value if it changed into the `RoomSummary` cache
…ing the room members of the room or when inviting someone
…the joined/invited user count or the heroes in a room change
This function will now also compute and store the active service members under the hood
This function will check the cached value and use it if available, falling back to using an approximate value that will be calculated synchronously if not.
…ring to have more accurate results
…::is_dm` Based on `Room::compute_is_dm`
Based on the cached and synchronous `Room::is_dm`
88a8cc5 to
1d7af29
Compare
51c245a to
1a6b534
Compare
RoomInfo::active_service_membersRoomInfo::active_service_members
…when you receive a member hints event that doesn't match what you previously had
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
RoomSummary::active_room_membersfield that will be used as a cache.Room::active_service_memberstoRoom::update_active_service_members, which will compute new values for the cache.async fn Room::is_dmtoRoom::compute_is_dmand also triggerRoom::update_active_service_membersto re-calculate the cache.Room::is_dmfunction that will use the cachedactive_service_membersvalue or calculate an approximate value as a fallback.Room::compute_is_dmandRoom::is_dminRoomInfo,NotificationRoomInfoandSpaceRoom.Motivation
For both the room list filtering and the
SpaceRoominstances we can't rely on an accurate value computed in place, since those APIs are synchronous. The approximate value previously calculated could be wrong in several cases, so if we can compute a better one instead that should make the checks more accurate.CHANGELOG.mdfiles.Signed-off-by: