Commit 2eefccad authored by wtc@chromium.org's avatar wtc@chromium.org

Handle the PrimeLint SSL read timeout better.

It takes more than 10 seconds to lint some CLs. Silently
ignore the expected timeout.

R=maruel@chromium.org,iannucci@chromium.org
BUG=290402
TEST=none

Review URL: https://codereview.chromium.org/130493002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@243968 0039d316-1c4b-4281-b951-d872f2087c98
parent d8b6599b
......@@ -13,6 +13,7 @@ import optparse
import os
import random
import re
import ssl
import string
import sys
import tempfile
......@@ -400,8 +401,14 @@ class ChangeInfo(object):
"""Do background work on Rietveld to lint the file so that the results are
ready when the issue is viewed."""
if self.issue and self.patchset:
self.SendToRietveld('/lint/issue%s_%s' % (self.issue, self.patchset),
timeout=10)
try:
self.SendToRietveld('/lint/issue%s_%s' % (self.issue, self.patchset),
timeout=10)
except ssl.SSLError as e:
# It takes more than 10 seconds to lint some CLs. Silently ignore
# the expected timeout.
if e.message != 'The read operation timed out':
raise
def SendToRietveld(self, request_path, timeout=None, **kwargs):
"""Send a POST/GET to Rietveld. Returns the response body."""
......
......@@ -108,7 +108,7 @@ class GclUnittest(GclTestsBase):
'gclient_utils', 'git_cl', 'json', 'main', 'need_change',
'need_change_and_args', 'no_args', 'optparse', 'os',
'presubmit_support', 'random', 're', 'rietveld',
'string', 'subprocess2', 'sys', 'tempfile', 'time',
'ssl', 'string', 'subprocess2', 'sys', 'tempfile', 'time',
'upload', 'urllib2',
]
# If this test fails, you should add the relevant test.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment