summary refs log tree commit diff
path: root/synapse/media/v1/thumbnail_resource.py
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2014-12-11 16:48:11 +0000
committerMark Haines <mark.haines@matrix.org>2014-12-11 16:48:11 +0000
commit03d9024cbcb4957b223d1a36e7ae2ad668b1859d (patch)
treed20e42445d3a9bbef5bdf2bb57daaff05bdb054b /synapse/media/v1/thumbnail_resource.py
parentLimit the size of images that are thumbnailed serverside. Limit the size of f... (diff)
downloadsynapse-03d9024cbcb4957b223d1a36e7ae2ad668b1859d.tar.xz
Allow only one download for a given image at a time, so that we don't end up downloading the same image twice if two clients request a remote image at the same time
Diffstat (limited to 'synapse/media/v1/thumbnail_resource.py')
-rw-r--r--synapse/media/v1/thumbnail_resource.py13
1 files changed, 3 insertions, 10 deletions
diff --git a/synapse/media/v1/thumbnail_resource.py b/synapse/media/v1/thumbnail_resource.py
index fd08c7ecd2..e19620d456 100644
--- a/synapse/media/v1/thumbnail_resource.py
+++ b/synapse/media/v1/thumbnail_resource.py
@@ -83,16 +83,9 @@ class ThumbnailResource(BaseMediaResource):
     @defer.inlineCallbacks
     def _respond_remote_thumbnail(self, request, server_name, media_id, width,
                                   height, method, m_type):
-        media_info = yield self.store.get_cached_remote_media(
-            server_name, media_id
-        )
-
-        if not media_info:
-            # TODO: Don't download the whole remote file
-            # We should proxy the thumbnail from the remote server instead.
-            media_info = yield self._download_remote_file(
-                server_name, media_id
-            )
+        # TODO: Don't download the whole remote file
+        # We should proxy the thumbnail from the remote server instead.
+        media_info = yield self._get_remote_media(server_name, media_id)
 
         thumbnail_infos = yield self.store.get_remote_media_thumbnails(
             server_name, media_id,