Skip to content

Commit b5db59a

Browse files
author
Ben Cotton
committed
Add a timeout to the URL call
1 parent e9ce37f commit b5db59a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cache_config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
# GLOBALS
5858
################################################################################
5959

60-
__version__ = "1.1"
60+
__version__ = "1.2"
6161

6262
# SOCKET CONFIGURATION
6363
__timeout__ = 2 # seconds
@@ -295,7 +295,7 @@ def downloadConfig(url, cache_file, temp_cache_file_fp, lastAttempt):
295295
modified = time.gmtime(os.path.getmtime(cache_file))
296296
RFC_1123_FORMAT = "%a, %d %b %Y %H:%M:%S GMT"
297297
req.add_header("If-Modified-Since", time.strftime(RFC_1123_FORMAT, modified))
298-
url_fp = urllib2.urlopen(req)
298+
url_fp = urllib2.urlopen(req, timeout=15)
299299
config = writeToFile(url_fp, temp_cache_file_fp, False)
300300
except Exception, e:
301301
if not lastAttempt:

0 commit comments

Comments
 (0)