forked from MirrorHub/synapse
Add cache to get_public_room_ids_at_stream_id
This commit is contained in:
parent
631376e2ac
commit
09cbcb78d3
2 changed files with 4 additions and 1 deletions
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
from ._base import BaseSlavedStore
|
from ._base import BaseSlavedStore
|
||||||
from synapse.storage import DataStore
|
from synapse.storage import DataStore
|
||||||
|
from synapse.storage.room import RoomStore
|
||||||
from ._slaved_id_tracker import SlavedIdTracker
|
from ._slaved_id_tracker import SlavedIdTracker
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,7 +31,7 @@ class RoomStore(BaseSlavedStore):
|
||||||
DataStore.get_current_public_room_stream_id.__func__
|
DataStore.get_current_public_room_stream_id.__func__
|
||||||
)
|
)
|
||||||
get_public_room_ids_at_stream_id = (
|
get_public_room_ids_at_stream_id = (
|
||||||
DataStore.get_public_room_ids_at_stream_id.__func__
|
RoomStore.__dict__["get_public_room_ids_at_stream_id"]
|
||||||
)
|
)
|
||||||
get_public_room_ids_at_stream_id_txn = (
|
get_public_room_ids_at_stream_id_txn = (
|
||||||
DataStore.get_public_room_ids_at_stream_id_txn.__func__
|
DataStore.get_public_room_ids_at_stream_id_txn.__func__
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
|
|
||||||
from synapse.api.errors import StoreError
|
from synapse.api.errors import StoreError
|
||||||
|
from synapse.util.caches.descriptors import cached
|
||||||
|
|
||||||
from ._base import SQLBaseStore
|
from ._base import SQLBaseStore
|
||||||
from .engines import PostgresEngine, Sqlite3Engine
|
from .engines import PostgresEngine, Sqlite3Engine
|
||||||
|
@ -346,6 +347,7 @@ class RoomStore(SQLBaseStore):
|
||||||
def get_current_public_room_stream_id(self):
|
def get_current_public_room_stream_id(self):
|
||||||
return self._public_room_id_gen.get_current_token()
|
return self._public_room_id_gen.get_current_token()
|
||||||
|
|
||||||
|
@cached(num_args=2, max_entries=100)
|
||||||
def get_public_room_ids_at_stream_id(self, stream_id, network_tuple):
|
def get_public_room_ids_at_stream_id(self, stream_id, network_tuple):
|
||||||
"""Get pulbic rooms for a particular list, or across all lists.
|
"""Get pulbic rooms for a particular list, or across all lists.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue