Skip to content

Commit e0b45d8

Browse files
authored
Remove lock from _connect (#86)
1 parent dd9669f commit e0b45d8

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

clickplc/util.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,13 @@ def _detect_pymodbus_version(self) -> None:
5252

5353
async def _connect(self) -> None:
5454
"""Start asynchronous reconnect loop."""
55-
async with self.lock:
56-
try:
57-
if self.pymodbus30plus:
58-
await asyncio.wait_for(self.client.connect(), timeout=self.timeout) # 3.x
59-
else: # 2.4.x - 2.5.x
60-
await self.client.start(self.ip) # type: ignore
61-
except Exception:
62-
raise OSError(f"Could not connect to '{self.ip}'.")
55+
try:
56+
if self.pymodbus30plus:
57+
await asyncio.wait_for(self.client.connect(), timeout=self.timeout) # 3.x
58+
else: # 2.4.x - 2.5.x
59+
await self.client.start(self.ip) # type: ignore
60+
except Exception:
61+
raise OSError(f"Could not connect to '{self.ip}'.")
6362

6463
async def read_coils(self, address: int, count):
6564
"""Read modbus output coils (0 address prefix)."""

0 commit comments

Comments
 (0)