summary refs log tree commit diff
path: root/synapse/util/async_helpers.py
diff options
context:
space:
mode:
authorBen Banfield-Zanin <benbz@matrix.org>2020-06-25 08:33:23 +0100
committerBen Banfield-Zanin <benbz@matrix.org>2020-06-25 08:33:23 +0100
commit2e9f389fd2d4cd9acaf9f4a0ac5e3ea358bfc860 (patch)
tree6f6f2b3d1b0c40c16008fd34e3435881e353bda8 /synapse/util/async_helpers.py
parentMerge remote-tracking branch 'origin/babolivier/info_mainline' into bbz/info-... (diff)
parentFix changelog wording (diff)
downloadsynapse-2e9f389fd2d4cd9acaf9f4a0ac5e3ea358bfc860.tar.xz
Merge remote-tracking branch 'origin/release-v1.15.1' into bbz/info-mainline-1.15
Diffstat (limited to 'synapse/util/async_helpers.py')
-rw-r--r--synapse/util/async_helpers.py12
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