mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 01:54:48 -04:00
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:
parent
4e3a617635
commit
35c308731d
3 changed files with 31 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue