Skip to content

Commit 13969e5

Browse files
committed
Rename reconnect_attempts to reconnect_max_attempts
1 parent 5f06a09 commit 13969e5

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

nats-client/src/nats/client/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def __init__(
176176
*,
177177
servers: list[str],
178178
allow_reconnect: bool = True,
179-
reconnect_attempts: int = 10,
179+
reconnect_max_attempts: int = 10,
180180
reconnect_time_wait: float = 2.0,
181181
reconnect_time_wait_max: float = 10.0,
182182
reconnect_jitter: float = 0.1,
@@ -190,7 +190,7 @@ def __init__(
190190
server_info: Server information
191191
servers: List of server addresses for the server pool
192192
allow_reconnect: Whether to automatically reconnect if the connection is lost
193-
reconnect_attempts: Maximum number of reconnection attempts (0 for unlimited)
193+
reconnect_max_attempts: Maximum number of reconnection attempts (0 for unlimited)
194194
reconnect_time_wait: Initial wait time between reconnection attempts
195195
reconnect_time_wait_max: Maximum wait time between reconnection attempts
196196
reconnect_jitter: Jitter factor for reconnection attempts
@@ -200,7 +200,7 @@ def __init__(
200200
self._connection = connection
201201
self._server_info = server_info
202202
self._allow_reconnect = allow_reconnect
203-
self._reconnect_max_attempts = reconnect_attempts
203+
self._reconnect_max_attempts = reconnect_max_attempts
204204
self._reconnect_time_wait = reconnect_time_wait
205205
self._reconnect_time_wait_max = reconnect_time_wait_max
206206
self._reconnect_jitter = reconnect_jitter
@@ -1018,7 +1018,7 @@ async def connect(
10181018
*,
10191019
timeout: float = 2.0,
10201020
allow_reconnect: bool = True,
1021-
reconnect_attempts: int = 10,
1021+
reconnect_max_attempts: int = 10,
10221022
reconnect_time_wait: float = 2.0,
10231023
reconnect_time_wait_max: float = 10.0,
10241024
reconnect_jitter: float = 0.1,
@@ -1096,7 +1096,7 @@ async def connect(
10961096
server_info,
10971097
servers=servers,
10981098
allow_reconnect=allow_reconnect,
1099-
reconnect_attempts=reconnect_attempts,
1099+
reconnect_max_attempts=reconnect_max_attempts,
11001100
reconnect_time_wait=reconnect_time_wait,
11011101
reconnect_time_wait_max=reconnect_time_wait_max,
11021102
reconnect_jitter=reconnect_jitter,

nats-client/tests/test_client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,7 @@ def on_reconnect():
505505
cluster.servers[0].client_url,
506506
timeout=0.5,
507507
allow_reconnect=True,
508+
reconnect_max_attempts=60,
508509
reconnect_time_wait=0.0,
509510
no_randomize=True
510511
)

nats-client/tests/test_subscription.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ async def test_subscription_receives_messages_after_reconnection(server):
473473
server.client_url,
474474
timeout=1.0,
475475
allow_reconnect=True,
476-
reconnect_attempts=10,
476+
reconnect_max_attempts=10,
477477
reconnect_time_wait=1.0,
478478
)
479479

0 commit comments

Comments
 (0)