summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2020-10-27 17:37:08 +0000
committerGitHub <noreply@github.com>2020-10-27 17:37:08 +0000
commit4215a3acd4a77cb3331144782d43f99635f3d0ed (patch)
tree66ab12f833f5826aef74c3391619b33a7118c73e
parentDon't unnecessarily start bg process while handling typing. (#8668) (diff)
downloadsynapse-4215a3acd4a77cb3331144782d43f99635f3d0ed.tar.xz
Don't unnecessarily start bg process in replication sending loop. (#8670)
-rw-r--r--changelog.d/8670.misc1
-rw-r--r--synapse/replication/tcp/resource.py10
2 files changed, 11 insertions, 0 deletions
diff --git a/changelog.d/8670.misc b/changelog.d/8670.misc
new file mode 100644

index 0000000000..cf6023f783 --- /dev/null +++ b/changelog.d/8670.misc
@@ -0,0 +1 @@ +Reduce number of OpenTracing spans started. diff --git a/synapse/replication/tcp/resource.py b/synapse/replication/tcp/resource.py
index 666c13fdb7..1d4ceac0f1 100644 --- a/synapse/replication/tcp/resource.py +++ b/synapse/replication/tcp/resource.py
@@ -117,6 +117,16 @@ class ReplicationStreamer: stream.discard_updates_and_advance() return + # We check up front to see if anything has actually changed, as we get + # poked because of changes that happened on other instances. + if all( + stream.last_token == stream.current_token(self._instance_name) + for stream in self.streams + ): + return + + # If there are updates then we need to set this even if we're already + # looping, as the loop needs to know that he might need to loop again. self.pending_updates = True if self.is_looping: