Skip to content

Commit

Permalink
Remove unnecessary lock
Browse files Browse the repository at this point in the history
  • Loading branch information
bbrondel committed Aug 22, 2024
1 parent 863272b commit 94260a6
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions python/lsst/ts/atbuilding/csc/building_csc.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ def __init__(
# Task that waits for messages from the TCP/IP controller.
self.listen_task = utils.make_done_future()

self.cmd_lock = asyncio.Lock()

# Set up a dummy tcpip client, to connect to later.
self.client = tcpip.Client(host="", port=0, log=self.log)

Expand Down Expand Up @@ -204,12 +202,11 @@ async def connect(self):

self.log.debug(f"Connecting to host={host}, port={port}")
try:
async with self.cmd_lock:
self.client = tcpip.Client(host=host, port=port, log=self.log)
await asyncio.wait_for(
self.client.start_task, timeout=self.config.connection_timeout
)
asyncio.create_task(self.listen_for_messages())
self.client = tcpip.Client(host=host, port=port, log=self.log)
await asyncio.wait_for(
self.client.start_task, timeout=self.config.connection_timeout
)
asyncio.create_task(self.listen_for_messages())
self.log.debug("connected")
except Exception as e:
err_msg = f"Could not open connection to host={host}, port={port}: {e!r}"
Expand Down

0 comments on commit 94260a6

Please sign in to comment.