Fixed listener stats thread hanging on network errors

* Same fix as before, urlopen() wasn't being used with a timeout.
* Fixes CC-5472 and SAAS-394 aka. listener stats breaking all the time
This commit is contained in:
Albert Santoni 2014-02-05 17:29:15 -05:00
parent 296adfdb24
commit b4e7b9324b

View file

@ -10,6 +10,8 @@ import time
from api_clients import api_client
class ListenerStat(Thread):
HTTP_REQUEST_TIMEOUT = 30 # 30 second HTTP request timeout
def __init__(self, logger=None):
Thread.__init__(self)
self.api_client = api_client.AirtimeApiClient()
@ -46,7 +48,7 @@ class ListenerStat(Thread):
url=url,
headers=header)
f = urllib2.urlopen(req)
f = urllib2.urlopen(req, timeout=ListenerStat.HTTP_REQUEST_TIMEOUT)
document = f.read()
return document