Created
February 22, 2015 17:44
-
-
Save jMyles/551b87195d2005bff30f to your computer and use it in GitHub Desktop.
This file contains 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
from hendrix.contrib.async import do_async | |
def my_view(request): | |
# blah blah blah, Django stuff | |
with do_async(pubsub_id) as reporter: | |
for long_thing in long_things: | |
result_of_long_thing = long_thing() | |
if result_of_long_thing.is_important(): | |
reporter.publish(result_of_long_thing) | |
return HttpResponse(blah) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is impossible, sadly, because there is no way in python for the context decorator on line 8 to change the thread in which the context block executes.