mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-29 06:56:11 -05:00
Add some caches to help read marker API
This commit is contained in:
parent
17445e6701
commit
33bebb63f3
@ -56,6 +56,7 @@ class SlavedAccountDataStore(TagsWorkerStore, AccountDataWorkerStore, BaseSlaved
|
||||
(row.data_type, row.user_id,)
|
||||
)
|
||||
self.get_account_data_for_user.invalidate((row.user_id,))
|
||||
self.get_account_data_for_room.invalidate((row.user_id, row.room_id,))
|
||||
self._account_data_stream_cache.entity_has_changed(
|
||||
row.user_id, token
|
||||
)
|
||||
|
@ -133,6 +133,7 @@ class AccountDataWorkerStore(SQLBaseStore):
|
||||
for row in rows
|
||||
})
|
||||
|
||||
@cached(num_args=2)
|
||||
def get_account_data_for_room(self, user_id, room_id):
|
||||
"""Get all the client account_data for a user for a room.
|
||||
|
||||
@ -310,6 +311,7 @@ class AccountDataStore(AccountDataWorkerStore):
|
||||
|
||||
self._account_data_stream_cache.entity_has_changed(user_id, next_id)
|
||||
self.get_account_data_for_user.invalidate((user_id,))
|
||||
self.get_account_data_for_room.invalidate((user_id, room_id,))
|
||||
|
||||
result = self._account_data_id_gen.get_current_token()
|
||||
defer.returnValue(result)
|
||||
|
@ -28,7 +28,7 @@ from synapse.util.logutils import log_function
|
||||
from synapse.util.metrics import Measure
|
||||
from synapse.api.constants import EventTypes
|
||||
from synapse.api.errors import SynapseError
|
||||
from synapse.util.caches.descriptors import cached
|
||||
from synapse.util.caches.descriptors import cached, cachedInlineCallbacks
|
||||
from synapse.types import get_domain_from_id
|
||||
|
||||
from canonicaljson import encode_canonical_json
|
||||
@ -2033,7 +2033,7 @@ class EventsStore(EventsWorkerStore):
|
||||
to_2, so_2 = yield self._get_event_ordering(event_id2)
|
||||
defer.returnValue((to_1, so_1) > (to_2, so_2))
|
||||
|
||||
@defer.inlineCallbacks
|
||||
@cachedInlineCallbacks(max_entries=5000)
|
||||
def _get_event_ordering(self, event_id):
|
||||
res = yield self._simple_select_one(
|
||||
table="events",
|
||||
|
Loading…
Reference in New Issue
Block a user