mirror of
https://github.com/element-hq/synapse.git
synced 2026-09-10 09:26:21 +00:00
Fix __len__ of Sliding Sync PerConnectionState ignoring account data (#20124)
Noticed while working on https://github.com/element-hq/synapse/pull/20003, submitting separately. ### Pull Request Checklist <!-- Please read https://element-hq.github.io/synapse/latest/development/contributing_guide.html before submitting your pull request --> * [x] Pull request is based on the develop branch * [x] Pull request includes a [changelog file](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#changelog). The entry should: - Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from `EventStore` to `EventWorkerStore`.". - Use markdown where necessary, mostly for `code blocks`. - End with either a period (.) or an exclamation mark (!). - Start with a capital letter. - Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry. * [x] [Code style](https://element-hq.github.io/synapse/latest/code_style.html) is correct (run the [linters](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#run-the-linters)) --------- Co-authored-by: Eric Eastwood <erice@element.io>
This commit is contained in:
co-authored by
Eric Eastwood
parent
57cf536ee4
commit
3debaff0f8
@@ -0,0 +1 @@
|
||||
Fix cache `__len__` of Sliding Sync `PerConnectionState` ignoring account data entries.
|
||||
@@ -919,6 +919,7 @@ class PerConnectionState:
|
||||
receipts: The status of each room for the receipts stream.
|
||||
room_configs: Map from room_id to the `RoomSyncConfig` of all
|
||||
rooms that we have previously sent down.
|
||||
account_data: The status of each room for the account_data stream.
|
||||
"""
|
||||
|
||||
last_used_ts: int | None = None
|
||||
@@ -951,7 +952,12 @@ class PerConnectionState:
|
||||
)
|
||||
|
||||
def __len__(self) -> int:
|
||||
return len(self.rooms) + len(self.receipts) + len(self.room_configs)
|
||||
return (
|
||||
len(self.account_data)
|
||||
+ len(self.rooms)
|
||||
+ len(self.receipts)
|
||||
+ len(self.room_configs)
|
||||
)
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
|
||||
Reference in New Issue
Block a user