mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-07 07:12:13 -04:00
Room Statistics (#4338)
This commit is contained in:
parent
f4c80d70f8
commit
4a30e4acb4
15 changed files with 1306 additions and 13 deletions
|
@ -611,3 +611,27 @@ class EventsWorkerStore(SQLBaseStore):
|
|||
return res
|
||||
|
||||
return self.runInteraction("get_rejection_reasons", f)
|
||||
|
||||
def _get_total_state_event_counts_txn(self, txn, room_id):
|
||||
"""
|
||||
See get_state_event_counts.
|
||||
"""
|
||||
sql = "SELECT COUNT(*) FROM state_events WHERE room_id=?"
|
||||
txn.execute(sql, (room_id,))
|
||||
row = txn.fetchone()
|
||||
return row[0] if row else 0
|
||||
|
||||
def get_total_state_event_counts(self, room_id):
|
||||
"""
|
||||
Gets the total number of state events in a room.
|
||||
|
||||
Args:
|
||||
room_id (str)
|
||||
|
||||
Returns:
|
||||
Deferred[int]
|
||||
"""
|
||||
return self.runInteraction(
|
||||
"get_total_state_event_counts",
|
||||
self._get_total_state_event_counts_txn, room_id
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue