mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-06-08 08:02:40 -04:00
Add StreamKeyType
class and replace string literals with constants (#12567)
This commit is contained in:
parent
3ce15cc7be
commit
83be72d76c
19 changed files with 125 additions and 80 deletions
|
@ -34,7 +34,7 @@ from synapse.storage._base import SQLBaseStore
|
|||
from synapse.storage.database import LoggingTransaction, make_in_list_sql_clause
|
||||
from synapse.storage.databases.main.stream import generate_pagination_where_clause
|
||||
from synapse.storage.engines import PostgresEngine
|
||||
from synapse.types import JsonDict, RoomStreamToken, StreamToken
|
||||
from synapse.types import JsonDict, RoomStreamToken, StreamKeyType, StreamToken
|
||||
from synapse.util.caches.descriptors import cached, cachedList
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -161,7 +161,9 @@ class RelationsWorkerStore(SQLBaseStore):
|
|||
if len(events) > limit and last_topo_id and last_stream_id:
|
||||
next_key = RoomStreamToken(last_topo_id, last_stream_id)
|
||||
if from_token:
|
||||
next_token = from_token.copy_and_replace("room_key", next_key)
|
||||
next_token = from_token.copy_and_replace(
|
||||
StreamKeyType.ROOM, next_key
|
||||
)
|
||||
else:
|
||||
next_token = StreamToken(
|
||||
room_key=next_key,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue