mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-07 01:14:56 -04:00
Convert simple_select_one and simple_select_one_onecol to async (#8162)
This commit is contained in:
parent
56efa9ec71
commit
4c6c56dc58
25 changed files with 220 additions and 113 deletions
|
@ -211,11 +211,11 @@ class StatsStore(StateDeltasStore):
|
|||
|
||||
return len(rooms_to_work_on)
|
||||
|
||||
def get_stats_positions(self):
|
||||
async def get_stats_positions(self) -> int:
|
||||
"""
|
||||
Returns the stats processor positions.
|
||||
"""
|
||||
return self.db_pool.simple_select_one_onecol(
|
||||
return await self.db_pool.simple_select_one_onecol(
|
||||
table="stats_incremental_position",
|
||||
keyvalues={},
|
||||
retcol="stream_id",
|
||||
|
@ -300,7 +300,7 @@ class StatsStore(StateDeltasStore):
|
|||
return slice_list
|
||||
|
||||
@cached()
|
||||
def get_earliest_token_for_stats(self, stats_type, id):
|
||||
async def get_earliest_token_for_stats(self, stats_type: str, id: str) -> int:
|
||||
"""
|
||||
Fetch the "earliest token". This is used by the room stats delta
|
||||
processor to ignore deltas that have been processed between the
|
||||
|
@ -308,11 +308,11 @@ class StatsStore(StateDeltasStore):
|
|||
being calculated.
|
||||
|
||||
Returns:
|
||||
Deferred[int]
|
||||
The earliest token.
|
||||
"""
|
||||
table, id_col = TYPE_TO_TABLE[stats_type]
|
||||
|
||||
return self.db_pool.simple_select_one_onecol(
|
||||
return await self.db_pool.simple_select_one_onecol(
|
||||
"%s_current" % (table,),
|
||||
keyvalues={id_col: id},
|
||||
retcol="completed_delta_stream_id",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue