Created
March 7, 2017 23:41
-
-
Save richvdh/39e794f43e3641deb7889e16cb2143d9 to your computer and use it in GitHub Desktop.
deferred test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@defer.inlineCallbacks | |
def test(): | |
with LoggingContext("TEST") as x: | |
x.request = "TEST" | |
yield test_handler() | |
@defer.inlineCallbacks | |
def test_handler(): | |
deferreds = [do_stuff(x) for x in ["bob", "chris"]] | |
yield preserve_context_over_deferred(defer.gatherResults(deferreds)) | |
@defer.inlineCallbacks | |
def do_stuff(arg): | |
yield hs.get_datastore().get_user_by_id(arg) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment