Merge pull request #1273 from coreos-inc/post_timeout

Increase POST timeout in secscan API
This commit is contained in:
Quentin Machu 2016-03-04 12:05:45 -05:00
commit 5a63d5033d
2 changed files with 3 additions and 1 deletions

View file

@ -286,6 +286,7 @@ class DefaultConfig(object):
'ENGINE_VERSION_TARGET': 2, 'ENGINE_VERSION_TARGET': 2,
'API_VERSION': 'v1', 'API_VERSION': 'v1',
'API_TIMEOUT_SECONDS': 10, 'API_TIMEOUT_SECONDS': 10,
'API_TIMEOUT_POST_SECONDS': 480,
} }
# Torrent management flags # Torrent management flags

View file

@ -248,11 +248,12 @@ class SecurityScannerAPI(object):
client = self.config['HTTPCLIENT'] client = self.config['HTTPCLIENT']
headers = {'Connection': 'close'} headers = {'Connection': 'close'}
timeout = security_config.get('API_TIMEOUT_SECONDS', 1) timeout = security_config.get('API_TIMEOUT_SECONDS', 1)
post_timeout = security_config.get('API_TIMEOUT_POST_SECONDS', 480)
with CloseForLongOperation(self.config): with CloseForLongOperation(self.config):
if method == 'POST': if method == 'POST':
logger.debug('POSTing security URL %s', url) logger.debug('POSTing security URL %s', url)
return client.post(url, json=body, params=params, timeout=timeout, cert=self._keys, return client.post(url, json=body, params=params, timeout=post_timeout, cert=self._keys,
verify=self._certificate, headers=headers) verify=self._certificate, headers=headers)
elif method == 'DELETE': elif method == 'DELETE':
logger.debug('DELETEing security URL %s', url) logger.debug('DELETEing security URL %s', url)