Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop response download from signal handler #4559

Merged
merged 5 commits into from May 27, 2020

Conversation

elacuesta
Copy link
Member

@elacuesta elacuesta commented May 10, 2020

Allow the cancellation of a download while it's in progress.

Motivated by #4205 (comment).

Tasks:

  • Implementation
  • Tests
  • Docs
    • Exceptions topic
    • Request/Response topic
    • FAQ entry
    • Note in the bytes_received signal docs

@codecov
Copy link

codecov bot commented May 10, 2020

Codecov Report

Merging #4559 into master will increase coverage by 0.05%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #4559      +/-   ##
==========================================
+ Coverage   84.56%   84.62%   +0.05%     
==========================================
  Files         164      164              
  Lines        9931     9948      +17     
  Branches     1477     1480       +3     
==========================================
+ Hits         8398     8418      +20     
+ Misses       1266     1265       -1     
+ Partials      267      265       -2     
Impacted Files Coverage Δ
scrapy/core/downloader/handlers/http11.py 93.03% <100.00%> (+0.30%) ⬆️
scrapy/exceptions.py 92.59% <100.00%> (+1.28%) ⬆️
scrapy/utils/signal.py 97.87% <100.00%> (+4.39%) ⬆️
scrapy/utils/trackref.py 85.71% <0.00%> (+2.85%) ⬆️

@elacuesta elacuesta marked this pull request as ready for review May 12, 2020
Copy link
Member

@Gallaecio Gallaecio left a comment

Beautiful.

scrapy/signalmanager.py Outdated Show resolved Hide resolved
tests/test_engine.py Outdated Show resolved Hide resolved
docs/topics/request-response.rst Outdated Show resolved Hide resolved
docs/topics/exceptions.rst Outdated Show resolved Hide resolved
@elacuesta elacuesta changed the title Cancel request download from signal handler Stop response download from signal handler May 12, 2020
@elacuesta elacuesta marked this pull request as draft May 14, 2020
@elacuesta elacuesta force-pushed the cancel-request-download branch from b480874 to dc590fe Compare May 14, 2020
@elacuesta elacuesta marked this pull request as ready for review May 15, 2020
docs/topics/exceptions.rst Outdated Show resolved Hide resolved
docs/topics/exceptions.rst Outdated Show resolved Hide resolved
docs/topics/exceptions.rst Outdated Show resolved Hide resolved
scrapy/core/scraper.py Outdated Show resolved Hide resolved
docs/topics/exceptions.rst Outdated Show resolved Hide resolved
docs/topics/request-response.rst Outdated Show resolved Hide resolved
@elacuesta elacuesta force-pushed the cancel-request-download branch from f6e7a22 to 276721a Compare May 20, 2020
scrapy/core/scraper.py Outdated Show resolved Hide resolved
@kmike
Copy link
Member

kmike commented May 27, 2020

Thanks @elacuesta!

@kmike kmike merged commit 13215cf into scrapy:master May 27, 2020
2 checks passed
@elacuesta elacuesta deleted the cancel-request-download branch May 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants