launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #15133
[Merge] lp:~stevenk/launchpad/use-timeout-for-checkwatches into lp:launchpad
Steve Kowalik has proposed merging lp:~stevenk/launchpad/use-timeout-for-checkwatches into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #567088 in Launchpad itself: "checkwatches keeps hanging at irregular intervals"
https://bugs.launchpad.net/launchpad/+bug/567088
For more details, see:
https://code.launchpad.net/~stevenk/launchpad/use-timeout-for-checkwatches/+merge/147586
Due to my earlier clean up work to make checkwatches make use of only one function to fetch a URL so that we are sure the headers are set correctly, sprinkle in the default_socket_timeout config option so that we give up after 30 seconds. Also feed that into the xmlrpc transport for the same reason.
--
https://code.launchpad.net/~stevenk/launchpad/use-timeout-for-checkwatches/+merge/147586
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/use-timeout-for-checkwatches into lp:launchpad.
=== modified file 'lib/lp/bugs/externalbugtracker/base.py'
--- lib/lp/bugs/externalbugtracker/base.py 2012-11-02 03:23:34 +0000
+++ lib/lp/bugs/externalbugtracker/base.py 2013-02-11 01:26:22 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2013 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""External bugtrackers."""
@@ -141,6 +141,7 @@
batch_size = None
batch_query_threshold = config.checkwatches.batch_query_threshold
+ timeout = config.checkwatches.default_socket_timeout
comment_template = 'default_remotecomment_template.txt'
def __init__(self, baseurl):
@@ -154,7 +155,7 @@
@ensure_no_transaction
def urlopen(self, request, data=None):
- return urllib2.urlopen(request, data)
+ return urllib2.urlopen(request, data, self.timeout)
def getExternalBugTrackerToUse(self):
"""See `IExternalBugTracker`."""
=== modified file 'lib/lp/bugs/externalbugtracker/xmlrpc.py'
--- lib/lp/bugs/externalbugtracker/xmlrpc.py 2012-06-29 08:40:05 +0000
+++ lib/lp/bugs/externalbugtracker/xmlrpc.py 2013-02-11 01:26:22 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2013 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""An XMLRPC transport which uses urllib2."""
@@ -28,6 +28,7 @@
Transport,
)
+from lp.services.config import config
from lp.services.utils import traceback_info
@@ -85,6 +86,7 @@
self.redirect_handler = XMLRPCRedirectHandler()
self.opener = build_opener(
self.cookie_processor, self.redirect_handler)
+ self.timeout = config.checkwatches.default_socket_timeout
def setCookie(self, cookie_str):
"""Set a cookie for the transport to use in future connections."""
@@ -108,7 +110,7 @@
headers = {'Content-type': 'text/xml'}
request = Request(url, request_body, headers)
try:
- response = self.opener.open(request).read()
+ response = self.opener.open(request, timeout=self.timeout).read()
except HTTPError as he:
raise ProtocolError(
request.get_full_url(), he.code, he.msg, he.hdrs)
Follow ups