diff options
author | Richard van der Hoff <richard@matrix.org> | 2018-04-27 14:31:23 +0100 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2018-04-27 14:31:23 +0100 |
commit | fc149b4eeb560286f4b54f53619b69089eeeaff8 (patch) | |
tree | a237b7a346ebf7c6db550ee65451a903c8ecf2d3 /synapse/rest | |
parent | Use run_in_background in preference to preserve_fn (diff) | |
parent | Merge branch 'master' of github.com:matrix-org/synapse into develop (diff) | |
download | synapse-fc149b4eeb560286f4b54f53619b69089eeeaff8.tar.xz |
Merge remote-tracking branch 'origin/develop' into rav/use_run_in_background
Diffstat (limited to 'synapse/rest')
-rw-r--r-- | synapse/rest/media/v1/storage_provider.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/synapse/rest/media/v1/storage_provider.py b/synapse/rest/media/v1/storage_provider.py index c188192f2b..0252afd9d3 100644 --- a/synapse/rest/media/v1/storage_provider.py +++ b/synapse/rest/media/v1/storage_provider.py @@ -18,7 +18,7 @@ from twisted.internet import defer, threads from .media_storage import FileResponder from synapse.config._base import Config -from synapse.util.logcontext import preserve_fn +from synapse.util.logcontext import run_in_background import logging import os @@ -87,7 +87,12 @@ class StorageProviderWrapper(StorageProvider): return self.backend.store_file(path, file_info) else: # TODO: Handle errors. - preserve_fn(self.backend.store_file)(path, file_info) + def store(): + try: + return self.backend.store_file(path, file_info) + except Exception: + logger.exception("Error storing file") + run_in_background(store) return defer.succeed(None) def fetch(self, path, file_info): |