Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 4d1a4f0

Browse files
committed
Fix get_un_partial_stated_rooms_token to take instance_name
1 parent 50776af commit 4d1a4f0

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

synapse/replication/tcp/streams/partial_state.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import attr
1717

1818
from synapse.replication.tcp.streams import Stream
19-
from synapse.replication.tcp.streams._base import current_token_without_instance
2019

2120
if TYPE_CHECKING:
2221
from synapse.server import HomeServer
@@ -43,7 +42,7 @@ def __init__(self, hs: "HomeServer"):
4342
super().__init__(
4443
hs.get_instance_name(),
4544
# TODO(faster_joins, multiple writers): we need to account for instance names
46-
current_token_without_instance(store.get_un_partial_stated_rooms_token),
45+
store.get_un_partial_stated_rooms_token,
4746
store.get_un_partial_stated_rooms_from_stream,
4847
)
4948

synapse/storage/databases/main/room.py

+4-7
Original file line numberDiff line numberDiff line change
@@ -1277,13 +1277,10 @@ async def get_join_event_id_and_device_lists_stream_id_for_partial_state(
12771277
)
12781278
return result["join_event_id"], result["device_lists_stream_id"]
12791279

1280-
def get_un_partial_stated_rooms_token(self) -> int:
1281-
# TODO(faster_joins, multiple writers): This is inappropriate if there
1282-
# are multiple writers because workers that don't write often will
1283-
# hold all readers up.
1284-
# (See `MultiWriterIdGenerator.get_persisted_upto_position` for an
1285-
# explanation.)
1286-
return self._un_partial_stated_rooms_stream_id_gen.get_current_token()
1280+
def get_un_partial_stated_rooms_token(self, instance_name: str) -> int:
1281+
return self._un_partial_stated_rooms_stream_id_gen.get_current_token_for_writer(
1282+
instance_name
1283+
)
12871284

12881285
async def get_un_partial_stated_rooms_from_stream(
12891286
self, instance_name: str, last_id: int, current_id: int, limit: int

0 commit comments

Comments
 (0)