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

This commit is contained in:
Mark Haines 2014-12-11 16:48:11 +00:00
parent d80d505b1f
commit 03d9024cbc
3 changed files with 29 additions and 20 deletions

View file

@ -56,14 +56,7 @@ class DownloadResource(BaseMediaResource):
@defer.inlineCallbacks
def _respond_remote_file(self, request, server_name, media_id):
media_info = yield self.store.get_cached_remote_media(
server_name, media_id
)
if not media_info:
media_info = yield self._download_remote_file(
server_name, media_id
)
media_info = yield self._get_remote_media(server_name, media_id)
media_type = media_info["media_type"]
filesystem_id = media_info["filesystem_id"]