Skip to content

Commit

Permalink
fix comment and only log error if error
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Guzik <[email protected]>
  • Loading branch information
Bravo555 committed Jul 11, 2024
1 parent b788c96 commit d0674c1
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions crates/extensions/c8y_mapper_ext/src/operations/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ impl OperationHandler {
/// need to be handled as well.
///
/// When an operation terminates (successfully or unsuccessfully), an MQTT operation clearing
/// message will be published, but it also needs to be handled when an MQTT broker echoes this
/// message back to us, so that `OperationHandler` can free the data associated with the
/// operation.
/// message will be published to the broker by the running operation task, but this message also
/// needs to be handled when an MQTT broker echoes it back to us, so that `OperationHandler` can
/// free the data associated with the operation.
pub async fn handle(&mut self, entity: EntityTarget, message: MqttMessage) {
let Ok((_, channel)) = self.context.mqtt_schema.entity_channel_of(&message.topic) else {
return;
Expand Down Expand Up @@ -164,14 +164,17 @@ impl OperationHandler {
} else {
let running_operation = RunningOperation::spawn(message, Arc::clone(&self.context));

self.running_operations.insert(topic, running_operation);
self.running_operations
.insert(topic.clone(), running_operation);
None
}
};

if let Some(terminated_operation) = terminated_operation {
let join_result = terminated_operation.handle.await;
error!("handle: {join_result:?}");
if let Err(err) = join_result {
error!(%topic, ?err, "operation task could not be joined");
}
}
}
}
Expand Down

0 comments on commit d0674c1

Please sign in to comment.