Created
January 24, 2011 20:59
-
-
Save saghul/793936 to your computer and use it in GitHub Desktop.
Decorator for deferring a function to a thread on Twisted
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
def defer_to_thread(func): | |
"""Decorator to run DB queries in Twisted's thread pool""" | |
def wrapper(*args, **kw): | |
return deferToThread(func, *args, **kw) | |
return wrapper |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment