Skip to content

Commit

Permalink
fixup! feat(advance-runner): log tainted session reason
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelstanley committed Aug 21, 2024
1 parent 9aeb6d3 commit e1758ed
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions offchain/advance-runner/src/server_manager/facade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,18 +199,21 @@ impl ServerManagerFacade {
}
});

// The server-manager does not inform the reasond for a tainted session.
// Trying to get it from the session's status.
// Capture advance-state error
if response.is_err() {
let sm_error = response.unwrap_err();
// The server-manager does not inform the reason for a tainted session.
match sm_error {
ServerManagerError::MethodCallError {
method: _,
request_id: _,
source,
} => {
let mut message = source.message().to_string();
// The server-manager signals with Code::Dataloss when the session has been previously tainted.
if source.code() == tonic::Code::DataLoss {
// Take action
// Trying to recover it from the session's status.
// If not available, we inform the original status error message.
let status_response = grpc_call!(
self,
get_session_status,
Expand All @@ -227,13 +230,14 @@ impl ServerManagerFacade {
request_id: _,
source,
} => {
let message = format!("Server manager session was tainted: {} ({})", source.code(), source.message());
tracing::error!(message);
message = format!("Server manager session was tainted: {} ({})", source.code(), source.message());
}
_ => {}
}
} else {
}
}
tracing::error!(message);
}
_ => {}
}
Expand Down

0 comments on commit e1758ed

Please sign in to comment.