Skip to content

Commit

Permalink
Merge pull request #360 from bulwark-security/improve-instantiate-err…
Browse files Browse the repository at this point in the history
…or-handling

Improve instantiate error handling
  • Loading branch information
sporkmonger authored Jun 26, 2024
2 parents fbfeb62 + 02345d3 commit f9bed6f
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions crates/ext-processor/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,19 @@ impl ExternalProcessor for BulwarkProcessor {
});

if let Some(route_target) = route_target {
// TODO: figure out how best to bubble the error out of the task and up to the parent
// TODO: figure out if tonic-error or some other option is the best way to convert to a tonic Status error
// TODO: we probably want to be initializing only when necessary now rather than on every request
let plugin_instances = bulwark_processor
let plugin_instances = match bulwark_processor
.instantiate_plugins(&route_target.plugins)
.await
.unwrap();
{
Ok(plugin_instances) => plugin_instances,
Err(err) => {
error!(
message = "error instantiating plugins",
error_message = ?err,
);
return;
}
};
if let Some(millis) = route_target.timeout {
timeout_duration = Duration::from_millis(millis);
}
Expand Down Expand Up @@ -215,9 +221,6 @@ impl ExternalProcessor for BulwarkProcessor {
.instrument(child_span.or_current()),
);
return Ok(tonic::Response::new(Box::pin(receiver)));

// // By default, just close the stream.
// Ok(tonic::Response::new(Box::pin(futures::stream::empty())))
}
}

Expand Down

0 comments on commit f9bed6f

Please sign in to comment.