Add the tiniest of tiny one-element caches to get_room_events_max_id() as it's read every time someone hits eventstream

This commit is contained in:
Paul "LeoNerd" Evans 2015-03-20 15:44:06 +00:00
parent 91cb46191d
commit ceb61daa70
2 changed files with 3 additions and 1 deletions

View file

@ -111,6 +111,7 @@ class DataStore(RoomMemberStore, RoomStore,
is_new_state=is_new_state,
current_state=current_state,
)
self.get_room_events_max_id.invalidate()
except _RollbackButIsFineException:
pass

View file

@ -35,7 +35,7 @@ what sort order was used:
from twisted.internet import defer
from ._base import SQLBaseStore
from ._base import SQLBaseStore, cached
from synapse.api.constants import EventTypes
from synapse.api.errors import SynapseError
from synapse.util.logutils import log_function
@ -413,6 +413,7 @@ class StreamStore(SQLBaseStore):
"get_recent_events_for_room", get_recent_events_for_room_txn
)
@cached(num_args=0)
def get_room_events_max_id(self):
return self.runInteraction(
"get_room_events_max_id",