summary refs log tree commit diff
path: root/synapse/rest/media/v1
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-05-08 16:27:36 +0100
committerErik Johnston <erik@matrix.org>2015-05-08 16:28:08 +0100
commitfca28d243e520dc3f8bae919182120c4757d575c (patch)
tree8ad6b2e52972dbdd3a67f9f3cc8f67e931c31880 /synapse/rest/media/v1
parentMerge branch 'master' of github.com:matrix-org/synapse into develop (diff)
downloadsynapse-fca28d243e520dc3f8bae919182120c4757d575c.tar.xz
Change the way we create observers to deferreds so that we don't get spammed by 'unhandled errors'
Diffstat (limited to 'synapse/rest/media/v1')
-rw-r--r--synapse/rest/media/v1/base_resource.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/synapse/rest/media/v1/base_resource.py b/synapse/rest/media/v1/base_resource.py
index 08c8d75af4..4af5f73878 100644
--- a/synapse/rest/media/v1/base_resource.py
+++ b/synapse/rest/media/v1/base_resource.py
@@ -25,7 +25,7 @@ from twisted.internet import defer
 from twisted.web.resource import Resource
 from twisted.protocols.basic import FileSender
 
-from synapse.util.async import create_observer
+from synapse.util.async import ObservableDeferred
 
 import os
 
@@ -83,13 +83,17 @@ class BaseMediaResource(Resource):
         download = self.downloads.get(key)
         if download is None:
             download = self._get_remote_media_impl(server_name, media_id)
+            download = ObservableDeferred(
+                download,
+                consumeErrors=True
+            )
             self.downloads[key] = download
 
             @download.addBoth
             def callback(media_info):
                 del self.downloads[key]
                 return media_info
-        return create_observer(download)
+        return download.observe()
 
     @defer.inlineCallbacks
     def _get_remote_media_impl(self, server_name, media_id):