Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Decorator to run the decorated function in a ThreadPool and return a deferred
def run_in_db_thread(func):
"""Decorator to run DB queries in Twisted's thread pool"""
def wrapper(*args, **kw):
return deferToThreadPool(reactor, pool, func, *args, **kw)
return wrapper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment