try this?

This commit is contained in:
Amber H. Brown 2019-07-02 21:49:55 +10:00
parent f8b52eb8c5
commit 0b95b49401

View file

@ -22,6 +22,7 @@ them.
See doc/log_contexts.rst for details on how this works.
"""
import types
import logging
import threading
@ -544,6 +545,9 @@ def run_in_background(f, *args, **kwargs):
# by synchronous exceptions, so let's turn them into Failures.
return defer.fail()
if isinstance(res, types.CoroutineType):
res = defer.ensureDeferred(res)
if not isinstance(res, defer.Deferred):
return res