diff options
author | Erik Johnston <erik@matrix.org> | 2016-04-07 14:24:12 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2016-04-07 14:24:12 +0100 |
commit | 639cd07d6d4e22e3413349bbd3bfb33db37a8d2f (patch) | |
tree | c85094891538773c907cc433762208e3d2c1f0bf /synapse | |
parent | Deduplicate joins (diff) | |
download | synapse-639cd07d6d4e22e3413349bbd3bfb33db37a8d2f.tar.xz |
Add comment
Diffstat (limited to '')
-rw-r--r-- | synapse/util/async.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/synapse/util/async.py b/synapse/util/async.py index 408c86be91..14a3dfd43f 100644 --- a/synapse/util/async.py +++ b/synapse/util/async.py @@ -164,6 +164,14 @@ class Linearizer(object): @defer.inlineCallbacks def queue(self, key): + # If there is already a deferred in the queue, we pull it out so that + # we can wait on it later. + # Then we replace it with a deferred that we resolve *after* the + # context manager has exited. + # We only return the context manager after the previous deferred has + # resolved. + # This all has the net effect of creating a chain of deferreds that + # wait for the previous deferred before starting their work. current_defer = self.key_to_defer.get(key) new_defer = defer.Deferred() |