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