Skip to content

Commit ff0958f

Browse files
committed
make connect retries configurable
fixes adafruit#14
1 parent c993271 commit ff0958f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

adafruit_minimqtt/adafruit_minimqtt.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ def __init__(
152152
ssl_context=None,
153153
use_binary_mode=False,
154154
socket_timeout=1,
155+
connect_retries=5,
155156
):
156157

157158
self._socket_pool = socket_pool
@@ -166,6 +167,7 @@ def __init__(
166167
)
167168
self._socket_timeout = socket_timeout
168169
self._recv_timeout = recv_timeout
170+
self._connect_retries = connect_retries
169171

170172
self.keep_alive = keep_alive
171173
self._user_data = None
@@ -267,7 +269,7 @@ def _get_connect_socket(self, host, port, *, timeout=1):
267269
sock = None
268270
retry_count = 0
269271
last_exception = None
270-
while retry_count < 5 and sock is None:
272+
while retry_count < self._connect_retries and sock is None:
271273
retry_count += 1
272274

273275
try:

0 commit comments

Comments
 (0)