hopefully this fixes CLI commands hanging

This commit is contained in:
Michael Gummelt
2015-06-29 15:10:03 -07:00
parent 14b3c8e5f6
commit a71ad237f1
2 changed files with 6 additions and 4 deletions

View File

@@ -103,10 +103,12 @@ def _segment_request(path, data):
SEGMENT_IO_WRITE_KEY_DEV
try:
# Set both the connect timeout and the request timeout to 1s,
# to prevent rollbar from hanging the CLI commands
http.post('{}/{}'.format(SEGMENT_URL, path),
json=data,
auth=HTTPBasicAuth(key, ''),
timeout=1)
timeout=(1, 1))
except Exception as e:
logger.exception(e)

View File

@@ -89,7 +89,7 @@ def test_config_set():
assert mock_called_some_args(http.post,
'{}/identify'.format(SEGMENT_URL),
json={'userId': 'test@mail.com'},
timeout=1)
timeout=(1, 1))
@_mock
@@ -112,7 +112,7 @@ def test_no_exc():
assert mock_called_some_args(http.post,
'{}/track'.format(SEGMENT_URL),
json=data,
timeout=1)
timeout=(1, 1))
# rollbar
assert rollbar.report_message.call_count == 0
@@ -145,7 +145,7 @@ def test_exc():
assert mock_called_some_args(http.post,
'{}/track'.format(SEGMENT_URL),
json=data,
timeout=1)
timeout=(1, 1))
# rollbar
props = _base_properties()