Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions python/sbp/client/drivers/network_drivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,13 @@ class TCPDriver(BaseDriver):

"""

def __init__(self, host, port, timeout=5, raise_initial_timeout=False, reconnect=False):
def __init__(self,
host,
port,
timeout=5,
raise_initial_timeout=False,
reconnect=False,
max_reconnect=MAX_RECONNECT_RETRIES):
self._address = (host, port)
print((host, port))
self._create_connection = partial(socket.create_connection,
Expand All @@ -53,6 +59,7 @@ def __init__(self, host, port, timeout=5, raise_initial_timeout=False, reconnect
self._write_lock = threading.Lock()
self._reconnect_count = 0
self._reconnect_supported = reconnect
self._max_reconnect = max_reconnect

def _connect(self, timeout_raises=False):
while True:
Expand All @@ -67,7 +74,7 @@ def _reconnect(self, exc):
if not self._reconnect_supported:
raise exc
while True:
if self._reconnect_count >= MAX_RECONNECT_RETRIES:
if self._reconnect_count >= self._max_reconnect:
raise exc
try:
self._connect(timeout_raises=True)
Expand Down
2 changes: 1 addition & 1 deletion test_data/benchmark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ echo "Python" $time_py
time_hs=$(TIMEFORMAT="%R"; { time $1/sbp2json < $TESTDATA_ROOT/long.sbp > $TESTDATA_ROOT/long_hask.json; } 2>&1)
echo "Haskell" $time_hs

threshold=1.51
threshold=1.6
perf_diff=$(echo "$time_py / $time_hs" | bc -l)

if (( $(echo "$perf_diff > $threshold" | bc -l) )); then
Expand Down