Skip to content

Commit

Permalink
change: increase priority of thumbnail downloads
Browse files Browse the repository at this point in the history
- intention behind this change: while watching a crawler "fill up" items in the front-end, this should reduce the delay between the creation of the learning object and the thumbnail data appearing

Signed-off-by: criamos <[email protected]>
  • Loading branch information
Criamos committed Dec 8, 2023
1 parent 79f48d7 commit b1cfc45
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions converter/pipelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,8 @@ async def process_item(self, raw_item, spider):
request_splash = scrapy.FormRequest(
url=_splash_url,
formdata=_splash_dict,
callback=NO_CALLBACK
callback=NO_CALLBACK,
priority=1
)
splash_response: scrapy.http.Response = await maybe_deferred_to_future(
spider.crawler.engine.download(request_splash)
Expand Down Expand Up @@ -550,7 +551,9 @@ async def download_thumbnail_url(self, url: str, spider: scrapy.Spider):
:return: Response or None
"""
try:
request = scrapy.Request(url=url, callback=NO_CALLBACK)
request = scrapy.Request(url=url, callback=NO_CALLBACK, priority=1)
# Thumbnail downloads will be executed with a slightly higher priority (default: 0), so there's less delay
# between metadata processing and thumbnail retrieval steps in the pipelines
response: Deferred | Future = await maybe_deferred_to_future(
spider.crawler.engine.download(request)
)
Expand Down

0 comments on commit b1cfc45

Please sign in to comment.