diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2018-04-27 11:47:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-27 11:47:49 +0100 |
commit | 9c3da2456183172677c27fbe6e0243af1a2c68a6 (patch) | |
tree | f022f1fc5930a11c0d9058544dc480cfbb7fdf9f /synapse/util/logcontext.py | |
parent | Merge pull request #3139 from matrix-org/rav/consume_errors (diff) | |
parent | Improve exception handling for background processes (diff) | |
download | synapse-9c3da2456183172677c27fbe6e0243af1a2c68a6.tar.xz |
Merge pull request #3138 from matrix-org/rav/catch_unhandled_exceptions
Improve exception handling for background processes
Diffstat (limited to 'synapse/util/logcontext.py')
-rw-r--r-- | synapse/util/logcontext.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/synapse/util/logcontext.py b/synapse/util/logcontext.py index d59adc236e..d6587e4409 100644 --- a/synapse/util/logcontext.py +++ b/synapse/util/logcontext.py @@ -305,7 +305,12 @@ def run_in_background(f, *args, **kwargs): deferred returned by the funtion completes. Useful for wrapping functions that return a deferred which you don't yield - on. + on (for instance because you want to pass it to deferred.gatherResults()). + + Note that if you completely discard the result, you should make sure that + `f` doesn't raise any deferred exceptions, otherwise a scary-looking + CRITICAL error about an unhandled error will be logged without much + indication about where it came from. """ current = LoggingContext.current_context() res = f(*args, **kwargs) |