Skip to content
Merged
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
6 changes: 3 additions & 3 deletions pymodbus/transport/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class CommParams:
comm_name: str | None = None
comm_type: CommType | None = None
reconnect_delay: float | None = None
reconnect_delay_max: float | None = None
reconnect_delay_max: float = 0.0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually there is a hidden problem here, "reconnect_delay_max" is defined a milliseconds and is an integer.

It seems asyncio.py does still use seconds, so I have to look at code before I approve this one.

timeout_connect: float | None = None
host: str = "127.0.0.1"
port: int = 0
Expand Down Expand Up @@ -433,7 +433,7 @@ def transport_close(self, intern: bool = False, reconnect: bool = False) -> None

def reset_delay(self) -> None:
"""Reset wait time before next reconnect to minimal period."""
self.reconnect_delay_current = self.comm_params.reconnect_delay
self.reconnect_delay_current = self.comm_params.reconnect_delay or 0.0

def is_active(self) -> bool:
"""Return true if connected/listening."""
Expand Down Expand Up @@ -468,7 +468,7 @@ def handle_new_connection(self) -> ModbusProtocol:
async def do_reconnect(self) -> None:
"""Handle reconnect as a task."""
try:
self.reconnect_delay_current = self.comm_params.reconnect_delay
self.reconnect_delay_current = self.comm_params.reconnect_delay or 0.0
while True:
Log.debug(
"Wait {} {} ms before reconnecting.",
Expand Down