mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-14 16:02:16 -04:00
Allow background tasks to be run on a separate worker. (#8369)
This commit is contained in:
parent
462e681c79
commit
62894673e6
19 changed files with 537 additions and 449 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue