Skip to content

Add request timeout to crawler _make_request to prevent hangs - #52

Open
bunlongheng wants to merge 1 commit into
MikeMeliz:masterfrom
bunlongheng:fix/missing-HTTP-timeout
Open

Add request timeout to crawler _make_request to prevent hangs#52
bunlongheng wants to merge 1 commit into
MikeMeliz:masterfrom
bunlongheng:fix/missing-HTTP-timeout

Conversation

@bunlongheng

Copy link
Copy Markdown

The crawler's _make_request calls urllib.request.urlopen without a timeout, so a slow or dead host (very common when crawling over Tor) blocks the whole crawl forever with no way to recover. I added timeout=10 to both urlopen calls, which matches what extractor.py already does for its own requests. Small change, it just makes the crawler fail fast instead of hanging on a bad host.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant