diff options
author | H. Shay <hillerys@element.io> | 2023-02-28 10:14:20 -0800 |
---|---|---|
committer | H. Shay <hillerys@element.io> | 2023-02-28 10:14:20 -0800 |
commit | b2fd03d075c8423f9205a3bed6e9621f2f063d46 (patch) | |
tree | 41c483b5b52ca138fb73cda0883df2ce9cfde3a6 /synapse/replication/tcp | |
parent | Update spam checker documentation for moved media modules. (#15175) (diff) | |
parent | 1.78.0 (diff) | |
download | synapse-b2fd03d075c8423f9205a3bed6e9621f2f063d46.tar.xz |
Merge branch 'master' into develop
Diffstat (limited to 'synapse/replication/tcp')
-rw-r--r-- | synapse/replication/tcp/resource.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/synapse/replication/tcp/resource.py b/synapse/replication/tcp/resource.py index 9d17eff714..347467d863 100644 --- a/synapse/replication/tcp/resource.py +++ b/synapse/replication/tcp/resource.py @@ -238,6 +238,24 @@ class ReplicationStreamer: except Exception: logger.exception("Failed to replicate") + # The last token we send may not match the current + # token, in which case we want to send out a `POSITION` + # to tell other workers the actual current position. + if updates[-1][0] < current_token: + logger.info( + "Sending position: %s -> %s", + stream.NAME, + current_token, + ) + self.command_handler.send_command( + PositionCommand( + stream.NAME, + self._instance_name, + updates[-1][0], + current_token, + ) + ) + logger.debug("No more pending updates, breaking poke loop") finally: self.pending_updates = False |