summary refs log tree commit diff
path: root/synapse/replication/tcp/client.py
diff options
context:
space:
mode:
authorBrendan Abolivier <babolivier@matrix.org>2020-09-03 15:30:00 +0100
committerBrendan Abolivier <babolivier@matrix.org>2020-09-03 15:30:00 +0100
commit505ea932f50b8995bbf101b45bafe7456c7534d5 (patch)
tree6161e859947944cb13bc6e92be10197b32ebd89a /synapse/replication/tcp/client.py
parentMerge branch 'develop' into matrix-org-hotfixes (diff)
parentRemove useless changelog about reverting a #8239. (diff)
downloadsynapse-505ea932f50b8995bbf101b45bafe7456c7534d5.tar.xz
Merge branch 'develop' into matrix-org-hotfixes
Diffstat (limited to 'synapse/replication/tcp/client.py')
-rw-r--r--synapse/replication/tcp/client.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/synapse/replication/tcp/client.py b/synapse/replication/tcp/client.py

index fcf8ebf1e7..d6ecf5b327 100644 --- a/synapse/replication/tcp/client.py +++ b/synapse/replication/tcp/client.py
@@ -14,7 +14,6 @@ # limitations under the License. """A replication client for use by synapse workers. """ -import heapq import logging from typing import TYPE_CHECKING, Dict, List, Tuple @@ -219,9 +218,8 @@ class ReplicationDataHandler: waiting_list = self._streams_to_waiters.setdefault(stream_name, []) - # We insert into the list using heapq as it is more efficient than - # pushing then resorting each time. - heapq.heappush(waiting_list, (position, deferred)) + waiting_list.append((position, deferred)) + waiting_list.sort(key=lambda t: t[0]) # We measure here to get in flight counts and average waiting time. with Measure(self._clock, "repl.wait_for_stream_position"):