Skip to content
Merged
Show file tree
Hide file tree
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
35 changes: 15 additions & 20 deletions src/client/microgrid_client_actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ async fn handle_instruction(
tx,
stream_status_tx,
)
.await?;
.await;

response_tx.send(rx).map_err(|_| {
tracing::error!("failed to send response");
Expand Down Expand Up @@ -220,7 +220,7 @@ async fn handle_retry_timer(
tx,
stream_status_tx.clone(),
)
.await?;
.await;
} else {
tracing::error!("Component stream not found for retry: {component_id}");
return Err(Error::internal(format!(
Expand All @@ -239,7 +239,7 @@ async fn start_electrical_component_telemetry_stream(
electrical_component_id: u64,
tx: broadcast::Sender<ElectricalComponentTelemetry>,
stream_status_tx: mpsc::Sender<StreamStatus>,
) -> Result<(), Error> {
) {
let stream = match client
.receive_electrical_component_telemetry_stream(
ReceiveElectricalComponentTelemetryStreamRequest {
Expand All @@ -251,28 +251,24 @@ async fn start_electrical_component_telemetry_stream(
{
Ok(s) => s.into_inner(),
Err(e) => {
stream_status_tx
let _ = stream_status_tx
.send(StreamStatus::Failed(electrical_component_id))
.await
.map_err(|e| {
Error::connection_failure(format!(
"receive_component_data_stream failed for {electrical_component_id}: {e}",
))
})?;
return Err(Error::connection_failure(format!(
"receive_component_data_stream failed for {electrical_component_id}: {e}",
)));
.await;

tracing::debug!("Failed to start telemetry stream for {electrical_component_id}: {e}",);
Comment thread
shsms marked this conversation as resolved.
return;
}
};

stream_status_tx
if let Err(e) = stream_status_tx
.send(StreamStatus::Connected(electrical_component_id))
.await
.map_err(|e| {
Error::connection_failure(format!(
"Failed to send stream recovered message for {electrical_component_id}: {e}",
))
})?;
{
tracing::error!(
"Failed to send stream connected message for {electrical_component_id}: {e}",
);
return;
}

// create a task to fetch data from the stream in a loop and put into a channel.
tokio::spawn(
Expand All @@ -284,7 +280,6 @@ async fn start_electrical_component_telemetry_stream(
)
.in_current_span(),
);
Ok(())
}

async fn run_electrical_component_telemetry_stream(
Expand Down
12 changes: 10 additions & 2 deletions src/proto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@

mod graph;

#[allow(clippy::doc_lazy_continuation, clippy::doc_overindented_list_items)]
#[allow(
clippy::doc_lazy_continuation,
clippy::doc_overindented_list_items,
dead_code
)]
pub mod common {
pub mod v1alpha8 {
pub mod grid {
Expand Down Expand Up @@ -40,7 +44,11 @@ pub mod common {
}
}

#[allow(clippy::doc_lazy_continuation, clippy::doc_overindented_list_items)]
#[allow(
clippy::doc_lazy_continuation,
clippy::doc_overindented_list_items,
dead_code
)]
pub mod microgrid {
pub mod v1alpha18 {
#![allow(clippy::derive_partial_eq_without_eq)]
Expand Down