Closed Bug 1049446 Opened 10 years ago Closed 10 years ago

Add timeouts to buildapi's urllib.urlopen() requests

Categories

(Release Engineering :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: emorley, Assigned: emorley)

References

Details

(Keywords: buildapi)

Attachments

(2 files)

buildapi equivalent of bug 884115 and friends.

Should help the blocking that we're seeing as part of bug 1049430 comment 2.
urllib.urlopen() doesn't support the timeout param, unlike urllib2.urlopen().
Helpfully, urllib2 doesn't support urlencode() or quote() - so we have to use a mixture of the two (some parts of buildapi are already using a mixture).

I'm _hopeful_ but not 100% sure that the switch from urllib.urlopen() to urllib2.urlopen() shouldn't affect any of the consumers in this patch.

See also:
http://www.hacksparrow.com/python-difference-between-urllib-and-urllib2.html
http://stackoverflow.com/a/2018074

Using a timeout of 30 seconds, the same as in mozharness. Note https://docs.python.org/2/library/urllib2.html describes this as "timeout in seconds for blocking operations like the connection attempt" - ie: the content transfer itself doesn't have to complete in under 30 seconds.
Attachment #8468377 - Flags: review?(nthomas)
Comment on attachment 8468377 [details] [diff] [review]
Add timeouts to buildapi's urllib.urlopen() requests

Review of attachment 8468377 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good. Per 
  https://wiki.mozilla.org/ReleaseEngineering/How_To/Update_BuildAPI
please bump the version to 0.3.2 in setup.py when you land. There's a matching puppet patch to write, but I can handle the rest.
Attachment #8468377 - Flags: review?(nthomas) → review+
Attachment #8471143 - Flags: review?(bugspam.Callek)
Deployed to the server side, staging and production (with bug 1043996).
Attachment #8471143 - Flags: review?(bugspam.Callek) → review+
Puppet deployed this to the 5 instances of selfserve-agent.
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
:-)
Component: Tools → General
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: