Skip to content

Instantly share code, notes, and snippets.

@saghul
Created Jan 24, 2011
Embed
What would you like to do?
Decorator for deferring a function to a thread on Twisted
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