diff options
author | Erik Johnston <erik@matrix.org> | 2020-05-27 20:06:29 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-27 20:06:29 +0100 |
commit | 8c5f88fa4d80f48d3080c7d240aa7ceaf454d690 (patch) | |
tree | 305d2c1325e730ceb275824cd0b4c6b1bb0d718c /synapse/util/async_helpers.py | |
parent | allow emails to be passed through SAML (#7385) (diff) | |
parent | Ensure we persist and ack the same token (diff) | |
download | synapse-8c5f88fa4d80f48d3080c7d240aa7ceaf454d690.tar.xz |
Merge pull request #7584 from matrix-org/erikj/save_and_send_fed_token_in_bg
Speed up processing of federation stream RDATA rows.
Diffstat (limited to 'synapse/util/async_helpers.py')
-rw-r--r-- | synapse/util/async_helpers.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/synapse/util/async_helpers.py b/synapse/util/async_helpers.py index 581dffd8a0..f7af2bca7f 100644 --- a/synapse/util/async_helpers.py +++ b/synapse/util/async_helpers.py @@ -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 |