Decorator to run the decorated function in a ThreadPool and return a deferred
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 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