Mercurial > public > sg101
diff core/management/commands/ssl_images.py @ 898:8fcd278d8987
Add socket timeout option.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 28 Feb 2015 14:35:47 -0600 |
parents | 49ebeb54990a |
children | 62cd07bb891c |
line wrap: on
line diff
--- a/core/management/commands/ssl_images.py Sat Feb 28 13:52:46 2015 -0600 +++ b/core/management/commands/ssl_images.py Sat Feb 28 14:35:47 2015 -0600 @@ -274,6 +274,9 @@ make_option('-j', '--j', type='int', help="optional second slice index; the j in [i:j]"), + make_option('-t', '--timeout', + type='int', + help="optional socket timeout (secs)"), ) def handle_noargs(self, **options): @@ -310,7 +313,9 @@ qs = qs[:j] # Set global socket timeout - socket.setdefaulttimeout(30) + timeout = options.get('timeout', 30) + logger.info("Setting socket timeout to %d", timeout) + socket.setdefaulttimeout(timeout) # Install signal handler for ctrl-c signal.signal(signal.SIGINT, signal_handler)