Skip to content

Commit

Permalink
[refactor] Fixing flow of http request on grpc response
Browse files Browse the repository at this point in the history
Signed-off-by: dd di cesare <[email protected]>
  • Loading branch information
didierofrivia committed Oct 31, 2024
1 parent 346d035 commit 06f654f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/filter/http_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,17 @@ impl Context for Filter {
if GrpcService::process_grpc_response(operation, resp_size).is_ok() {
// call the next op
match self.operation_dispatcher.borrow_mut().next() {
Ok(_) => {} // no action needed
Ok(some_op) => {
if some_op.is_none() {
// No more operations left in queue, resuming
self.resume_http_request();
}
}
Err(op_err) => {
// If desired, we could check the error status.
GrpcService::handle_error_on_grpc_response(op_err.failure_mode);
}
}
self.resume_http_request();
}
}
Err(e) => {
Expand Down
2 changes: 1 addition & 1 deletion src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl GrpcService {
match failure_mode {
FailureMode::Deny => {
hostcalls::send_http_response(500, vec![], Some(b"Internal Server Error.\n"))
.unwrap()
.unwrap();
}
FailureMode::Allow => hostcalls::resume_http_request().unwrap(),
}
Expand Down

0 comments on commit 06f654f

Please sign in to comment.