-
-
Notifications
You must be signed in to change notification settings - Fork 103
Add a timeout to the url requests #207
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -160,6 +160,7 @@ def get_page_for_platform( | |
try: | ||
data = urlopen( | ||
Request(page_url, headers=REQUEST_HEADERS), | ||
timeout = 2, | ||
context=URLOPEN_CONTEXT | ||
).read() | ||
data_downloaded = True | ||
|
@@ -267,6 +268,8 @@ def get_page( | |
except URLError: | ||
if not PAGES_SOURCE_LOCATION.startswith('file://'): | ||
raise | ||
except TimeoutError: | ||
continue | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure we should be skipping this, in that we don't skip if we get a 500 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've read some more info about that and I've noticed that in fact a |
||
|
||
return False | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is two seconds long enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so, but i wouldn't care if it was set to 10 seconds or something like that. The problem that i saw was that, if no timeout was specified, there were some occasions where the program would get stuck for more than a minute until throwing a timeout error. However I believe that 2 seconds are more than enough.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've bumped this up to 10 seconds as I feel like while 2 is probably fine, better to be a touch conservative and hopefully avoid any people complaining about things "suddenly" breaking on them due to timeouts, and this still at least more rapidly gets this program to crash out much more quickly.