Skip to content

Commit

Permalink
make sure we use ensure send where its supposed to be used
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanthecoder committed Jun 21, 2024
1 parent e51d5f5 commit b354aa0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions hardware/opentrons_hardware/hardware_control/tool_sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ async def run_stream_output_to_csv(
binding_field = SensorOutputBindingField.from_flags(binding)
for sensor_id in sensors.keys():
sensor_info = sensors[sensor_id].sensor
await messenger.send(
await messenger.ensure_send(
node_id=sensor_info.node_id,
message=BindSensorOutputRequest(
payload=BindSensorOutputRequestPayload(
Expand All @@ -245,6 +245,7 @@ async def run_stream_output_to_csv(
binding=binding_field,
)
),
expected_nodes=[sensor_info.node_id],
)

messenger.add_listener(sensor_capturer, None)
Expand All @@ -254,7 +255,7 @@ async def run_stream_output_to_csv(

for sensor_id in sensors.keys():
sensor_info = sensors[sensor_id].sensor
await messenger.send(
await messenger.ensure_send(
node_id=sensor_info.node_id,
message=BindSensorOutputRequest(
payload=BindSensorOutputRequestPayload(
Expand All @@ -263,6 +264,7 @@ async def run_stream_output_to_csv(
binding=SensorOutputBindingField(SensorOutputBinding.none),
)
),
expected_nodes=[sensor_info.node_id],
)
return positions

Expand Down Expand Up @@ -342,7 +344,7 @@ async def _run_with_binding(
binding_field = SensorOutputBindingField.from_flags(binding)
for sensor_id in sensors.keys():
sensor_info = sensors[sensor_id].sensor
await messenger.send(
await messenger.ensure_send(
node_id=sensor_info.node_id,
message=BindSensorOutputRequest(
payload=BindSensorOutputRequestPayload(
Expand All @@ -351,12 +353,13 @@ async def _run_with_binding(
binding=binding_field,
)
),
expected_nodes=[sensor_info.node_id],
)

result = await sensor_runner.run(can_messenger=messenger)
for sensor_id in sensors.keys():
sensor_info = sensors[sensor_id].sensor
await messenger.send(
await messenger.ensure_send(
node_id=sensor_info.node_id,
message=BindSensorOutputRequest(
payload=BindSensorOutputRequestPayload(
Expand All @@ -365,6 +368,7 @@ async def _run_with_binding(
binding=SensorOutputBindingField(SensorOutputBinding.none),
)
),
expected_nodes=[sensor_info.node_id],
)
return result

Expand Down

0 comments on commit b354aa0

Please sign in to comment.