Skip to content

Instantly share code, notes, and snippets.

@jMyles
Created February 22, 2015 17:44
Show Gist options
  • Save jMyles/551b87195d2005bff30f to your computer and use it in GitHub Desktop.
Save jMyles/551b87195d2005bff30f to your computer and use it in GitHub Desktop.
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)
@jMyles
Copy link
Author

jMyles commented Feb 23, 2015

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment