Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Use _invalidate_cache_and_stream_bulk in more places. #16616

Merged
merged 1 commit into from
Nov 9, 2023

Conversation

clokep
Copy link
Member

@clokep clokep commented Nov 9, 2023

Builds on #16613 to use the new bulk invalidation logic in more places.

I found these via:

grep -C15 -r "_invalidate_cache_and_stream" synapse | grep -E "for .+ in .+:"

I'm likely missing more though. 🤷

@clokep clokep requested a review from a team as a code owner November 9, 2023 17:23
Comment on lines +318 to 320
for event_id, should_delete in event_rows:
if should_delete:
self._invalidate_cache_and_stream(
txn, self.have_seen_event, (room_id, event_id)
)
self.invalidate_get_event_cache_after_txn(txn, event_id)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This invalidates local caches, so I think is fine to leave in the loop.

Comment on lines +564 to +569
tokens = self.db_pool.simple_select_list_txn(
txn,
table="access_tokens",
keyvalues={"user_id": user_id},
retcol="token",
retcols=("token",),
)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of unpacking a tuple from the database (using the select_onecol version) and then repacking it into a tuple, it makes more sense to simply pass the tuples in.

Copy link
Contributor

@DMRobertson DMRobertson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@clokep clokep enabled auto-merge (squash) November 9, 2023 17:31
@clokep clokep disabled auto-merge November 9, 2023 19:39
@clokep clokep merged commit 9f514dd into develop Nov 9, 2023
38 of 41 checks passed
@clokep clokep deleted the clokep/more-bulk-invalidation branch November 9, 2023 19:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants