diff options
author | Erik Johnston <erikj@jki.re> | 2017-04-25 11:18:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-25 11:18:07 +0100 |
commit | b4da08cad8ca911eb6d6c6f52f5e656f524c0771 (patch) | |
tree | 46dff436081daf9c62a54b4b93e64caeda65d1d1 /synapse/storage | |
parent | Merge pull request #2156 from matrix-org/markjh/old_verify_keys (diff) | |
parent | Remove DEBUG_CACHES (diff) | |
download | synapse-b4da08cad8ca911eb6d6c6f52f5e656f524c0771.tar.xz |
Merge pull request #2158 from matrix-org/erikj/reduce_cache_size
Reduce cache size by not storing deferreds
Diffstat (limited to 'synapse/storage')
-rw-r--r-- | synapse/storage/receipts.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/synapse/storage/receipts.py b/synapse/storage/receipts.py index 6b0f8c2787..efb90c3c91 100644 --- a/synapse/storage/receipts.py +++ b/synapse/storage/receipts.py @@ -47,10 +47,13 @@ class ReceiptsStore(SQLBaseStore): # Returns an ObservableDeferred res = self.get_users_with_read_receipts_in_room.cache.get((room_id,), None) - if res and res.called and user_id in res.result: - # We'd only be adding to the set, so no point invalidating if the - # user is already there - return + if res: + if isinstance(res, defer.Deferred) and res.called: + res = res.result + if user_id in res: + # We'd only be adding to the set, so no point invalidating if the + # user is already there + return self.get_users_with_read_receipts_in_room.invalidate((room_id,)) |