diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2020-10-02 08:23:15 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-02 08:23:15 -0400 |
commit | 62894673e69f7beb0d0a748ad01c2e95c5fed106 (patch) | |
tree | f3f70c95bc635045e833f8a62e1572258dee3bf9 /synapse/storage/databases/main/room.py | |
parent | Merge tag 'v1.21.0rc2' into develop (diff) | |
download | synapse-62894673e69f7beb0d0a748ad01c2e95c5fed106.tar.xz |
Allow background tasks to be run on a separate worker. (#8369)
Diffstat (limited to 'synapse/storage/databases/main/room.py')
-rw-r--r-- | synapse/storage/databases/main/room.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/synapse/storage/databases/main/room.py b/synapse/storage/databases/main/room.py index 3c7630857f..c0f2af0785 100644 --- a/synapse/storage/databases/main/room.py +++ b/synapse/storage/databases/main/room.py @@ -192,6 +192,18 @@ class RoomWorkerStore(SQLBaseStore): "count_public_rooms", _count_public_rooms_txn ) + async def get_room_count(self) -> int: + """Retrieve the total number of rooms. + """ + + def f(txn): + sql = "SELECT count(*) FROM rooms" + txn.execute(sql) + row = txn.fetchone() + return row[0] or 0 + + return await self.db_pool.runInteraction("get_rooms", f) + async def get_largest_public_rooms( self, network_tuple: Optional[ThirdPartyInstanceID], @@ -1292,18 +1304,6 @@ class RoomStore(RoomBackgroundUpdateStore, RoomWorkerStore, SearchStore): ) self.hs.get_notifier().on_new_replication_data() - async def get_room_count(self) -> int: - """Retrieve the total number of rooms. - """ - - def f(txn): - sql = "SELECT count(*) FROM rooms" - txn.execute(sql) - row = txn.fetchone() - return row[0] or 0 - - return await self.db_pool.runInteraction("get_rooms", f) - async def add_event_report( self, room_id: str, |