mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-04 03:24:49 -04:00
Re-implement unread counts (again) (#8059)
This commit is contained in:
parent
0d4f614fda
commit
5a1dd297c3
12 changed files with 457 additions and 122 deletions
|
@ -47,7 +47,11 @@ from synapse.api.filtering import Filter
|
|||
from synapse.events import EventBase
|
||||
from synapse.logging.context import make_deferred_yieldable, run_in_background
|
||||
from synapse.storage._base import SQLBaseStore
|
||||
from synapse.storage.database import DatabasePool, make_in_list_sql_clause
|
||||
from synapse.storage.database import (
|
||||
DatabasePool,
|
||||
LoggingTransaction,
|
||||
make_in_list_sql_clause,
|
||||
)
|
||||
from synapse.storage.databases.main.events_worker import EventsWorkerStore
|
||||
from synapse.storage.engines import BaseDatabaseEngine, PostgresEngine
|
||||
from synapse.types import RoomStreamToken
|
||||
|
@ -593,8 +597,19 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore):
|
|||
Returns:
|
||||
A stream ID.
|
||||
"""
|
||||
return await self.db_pool.simple_select_one_onecol(
|
||||
table="events", keyvalues={"event_id": event_id}, retcol="stream_ordering"
|
||||
return await self.db_pool.runInteraction(
|
||||
"get_stream_id_for_event", self.get_stream_id_for_event_txn, event_id,
|
||||
)
|
||||
|
||||
def get_stream_id_for_event_txn(
|
||||
self, txn: LoggingTransaction, event_id: str, allow_none=False,
|
||||
) -> int:
|
||||
return self.db_pool.simple_select_one_onecol_txn(
|
||||
txn=txn,
|
||||
table="events",
|
||||
keyvalues={"event_id": event_id},
|
||||
retcol="stream_ordering",
|
||||
allow_none=allow_none,
|
||||
)
|
||||
|
||||
async def get_stream_token_for_event(self, event_id: str) -> str:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue