Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
erikjohnston committed Apr 7, 2016
1 parent af03ecf commit 639cd07
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions synapse/util/async.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,14 @@ def __init__(self):

@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()
Expand Down

0 comments on commit 639cd07

Please sign in to comment.