eagle-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From haoch <...@git.apache.org>
Subject [GitHub] incubator-eagle pull request #686: [MINOR] add retry when read jmx timeout
Date Tue, 29 Nov 2016 07:48:14 GMT
Github user haoch commented on a diff in the pull request:

    https://github.com/apache/incubator-eagle/pull/686#discussion_r89955056
  
    --- Diff: eagle-external/hadoop_jmx_collector/metric_collector.py ---
    @@ -93,21 +93,26 @@ def http_get(host, port, https=False, path=None):
             url = ":".join([host, str(port)])
             result = None
             response = None
    -        try:
    -            if https:
    -                logging.info("Reading https://" + str(url) + path)
    -                c = httplib.HTTPSConnection(url, timeout=57)
    -                c.request("GET", path)
    -                response = c.getresponse()
    -            else:
    -                logging.info("Reading http://" + str(url) + path)
    -                response = urllib2.urlopen("http://" + str(url) + path, timeout=57)
    -            logging.debug("Got response")
    -            result = response.read()
    -        finally:
    -            if response is not None:
    -                response.close()
    -            return result
    +        attempts = 0
    +        while attempts < 2:
    +            try:
    +                if https:
    +                    logging.info("Reading https://" + str(url) + path)
    +                    c = httplib.HTTPSConnection(url, timeout=28)
    +                    c.request("GET", path)
    +                    response = c.getresponse()
    +                else:
    +                    logging.info("Reading http://" + str(url) + path)
    +                    response = urllib2.urlopen("http://" + str(url) + path, timeout=28)
    +                logging.debug("Got response")
    +                result = response.read()
    +            except Exception as e:
    +                logging.warning(e)
    +                attempts += 1
    +            finally:
    +                if response is not None:
    +                    response.close()
    +                return result
    --- End diff --
    
    here is bug


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message