mirror of
https://github.com/scrapy/scrapy.git
synced 2025-02-22 21:23:50 +00:00
media pipeline: no need for complex deferred execution
--HG-- extra : convert_revision : svn%3Ab85faa78-f9eb-468e-a121-7cced6da292c%40397
This commit is contained in:
parent
a6ff165332
commit
0938984de0
@ -65,14 +65,11 @@ class MediaPipeline(object):
|
||||
# add to pending list for this request, and wait for result like the others.
|
||||
info.waiting.setdefault(fp, []).append(wad)
|
||||
|
||||
# if request is already downloading, just wait.
|
||||
if fp in info.downloading:
|
||||
return wad # break
|
||||
# if request is not downloading, download it.
|
||||
if fp not in info.downloading:
|
||||
self._download(request, info, fp)
|
||||
|
||||
# if not, this is the first time for request, try to download it.
|
||||
dfd = self._download(request, info, fp)
|
||||
dfd.addCallback(lambda _: wad)
|
||||
return dfd
|
||||
return wad
|
||||
|
||||
def _download(self, request, info, fp):
|
||||
def _bugtrap(_failure):
|
||||
@ -109,7 +106,6 @@ class MediaPipeline(object):
|
||||
# defer pre-download request processing
|
||||
dfd = mustbe_deferred(self.media_to_download, request, info)
|
||||
dfd.addCallback(_evaluated)
|
||||
return dfd
|
||||
|
||||
### Overradiable Interface
|
||||
def download(self, request, info):
|
||||
|
Loading…
x
Reference in New Issue
Block a user