mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-08 00:22:22 -04:00
Return read-only collections from @cached
methods (#13755)
It's important that collections returned from `@cached` methods are not modified, otherwise future retrievals from the cache will return the modified collection. This applies to the return values from `@cached` methods and the values inside the dictionaries returned by `@cachedList` methods. It's not necessary for the dictionaries returned by `@cachedList` methods themselves to be read-only. Signed-off-by: Sean Quah <seanq@matrix.org> Co-authored-by: David Robertson <davidr@element.io>
This commit is contained in:
parent
14be78d492
commit
d0c713cc85
27 changed files with 98 additions and 77 deletions
|
@ -23,6 +23,7 @@ from typing import (
|
|||
Collection,
|
||||
Dict,
|
||||
List,
|
||||
Mapping,
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
|
@ -1512,7 +1513,7 @@ class FederationHandlerRegistry:
|
|||
def _get_event_ids_for_partial_state_join(
|
||||
join_event: EventBase,
|
||||
prev_state_ids: StateMap[str],
|
||||
summary: Dict[str, MemberSummary],
|
||||
summary: Mapping[str, MemberSummary],
|
||||
) -> Collection[str]:
|
||||
"""Calculate state to be returned in a partial_state send_join
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue