mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-12 18:12:10 -04:00
Wait for streams to catch up when processing HTTP replication. (#14820)
This should hopefully mitigate a class of races where data gets out of sync due a HTTP replication request racing with the replication streams.
This commit is contained in:
parent
e8f2bf5c40
commit
9187fd940e
21 changed files with 225 additions and 144 deletions
|
@ -54,6 +54,10 @@ class ReplicationGetStreamUpdates(ReplicationEndpoint):
|
|||
PATH_ARGS = ("stream_name",)
|
||||
METHOD = "GET"
|
||||
|
||||
# We don't want to wait for replication streams to catch up, as this gets
|
||||
# called in the process of catching replication streams up.
|
||||
WAIT_FOR_STREAMS = False
|
||||
|
||||
def __init__(self, hs: "HomeServer"):
|
||||
super().__init__(hs)
|
||||
|
||||
|
@ -67,7 +71,7 @@ class ReplicationGetStreamUpdates(ReplicationEndpoint):
|
|||
return {"from_token": from_token, "upto_token": upto_token}
|
||||
|
||||
async def _handle_request( # type: ignore[override]
|
||||
self, request: Request, stream_name: str
|
||||
self, request: Request, content: JsonDict, stream_name: str
|
||||
) -> Tuple[int, JsonDict]:
|
||||
stream = self.streams.get(stream_name)
|
||||
if stream is None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue