Speed up processing of federation stream RDATA rows.

Instead of storing and sending an ACK for every single row we send
synchronously, we instead do it asynchronously while batching up
updates.
This commit is contained in:
Erik Johnston 2020-05-27 19:31:44 +01:00
parent 4e3a617635
commit 35c308731d
3 changed files with 31 additions and 2 deletions

View file

@ -225,6 +225,18 @@ class Linearizer(object):
{}
) # type: Dict[str, Sequence[Union[int, Dict[defer.Deferred, int]]]]
def is_queued(self, key) -> bool:
"""Checks whether there is a process queued up waiting
"""
entry = self.key_to_defer.get(key)
if not entry:
# No entry so nothing is waiting.
return False
# There are waiting deferreds only in the OrderedDict of deferreds is
# non-empty.
return bool(entry[1])
def queue(self, key):
# we avoid doing defer.inlineCallbacks here, so that cancellation works correctly.
# (https://twistedmatrix.com/trac/ticket/4632 meant that cancellations were not