Skip to content

event cache: having any ignored user will aggressively clear all rooms' caches #4784

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

Closed
bnjbvr opened this issue Mar 11, 2025 · 1 comment · Fixed by #4779
Closed

event cache: having any ignored user will aggressively clear all rooms' caches #4784

bnjbvr opened this issue Mar 11, 2025 · 1 comment · Fixed by #4779
Assignees

Comments

@bnjbvr
Copy link
Member

bnjbvr commented Mar 11, 2025

If the sync returns a state event of the kind IgnoredUserList, then this triggers the observable ignore_user_list_changes in the base client:

if let Some(event) = changes.account_data.get(&GlobalAccountDataEventType::IgnoredUserList)
{
match event.deserialize_as::<IgnoredUserListEvent>() {
Ok(event) => {
let user_ids: Vec<String> =
event.content.ignored_users.keys().map(|id| id.to_string()).collect();
self.ignore_user_list_changes.set(user_ids);

Unfortunately, this will cause a clear of all the rooms in the event cache:

while ignore_user_list_stream.next().await.is_some() {
info!("Received an ignore user list change");
if let Err(err) = inner.clear_all_rooms().await {
error!("when clearing room storage after ignore user list change: {err}");
}
}

This might not be an issue, if only the initial sync contained the ignored-user-list event, and the event cache has been subscribed to after the first initial sync has been received. But in general, this is a footgun that would be nice to avoid. Things I can imagine to solve this:

  • only trigger the observable when the value changed, compared to a previous value we knew about. Meaning we'd compare the new value with the one stored in the database.
  • equivalently, maintain a list of ignored users in the event cache, and only clear the room if this list has changed

Likely a blocker for #3280.

cc @Hywan

@bnjbvr
Copy link
Member Author

bnjbvr commented Mar 11, 2025

#4779 includes a patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant