Skip to content

Commit

Permalink
fix: Resolve import errors and update body handling in ducks integration
Browse files Browse the repository at this point in the history
  • Loading branch information
scottopell committed Dec 27, 2024
1 parent 9b4f3fd commit a36eadb
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions integration/ducks/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
use anyhow::Context;
use bytes::BytesMut;
use hyper::{service::service_fn, Method, Request, Response, StatusCode};
use hyper::Server as HyperServer;
use hyper::{service::service_fn, Method, Request, Response, StatusCode, Body};
use tonic::transport::Server as HyperServer;
use http_body_util::BodyExt;
use once_cell::sync::OnceCell;
use shared::{
Expand All @@ -36,7 +36,6 @@ use tokio::{
};
use tokio_stream::{wrappers::UnixListenerStream, Stream};
use tonic::body::BoxBody;
use tonic::transport::Server;
use tonic::Status;
use tracing::{debug, trace, warn};

Expand Down Expand Up @@ -125,7 +124,7 @@ impl From<&SocketCounters> for SocketMetrics {
#[tracing::instrument(level = "trace")]
async fn http_req_handler(req: Request<BoxBody>) -> Result<Response<BoxBody>, hyper::Error> {
let (parts, body) = req.into_parts();
let body_bytes = hyper::body::to_bytes(body).await?;
let body_bytes = body.to_bytes().await?;

{
let metric = HTTP_COUNTERS.get().expect("HTTP_COUNTERS not initialized");
Expand All @@ -141,7 +140,7 @@ async fn http_req_handler(req: Request<BoxBody>) -> Result<Response<BoxBody>, hy
*method_counter += 1;
}

let mut resp = Response::new(BoxBody::from(hyper::Body::empty()));
let mut resp = Response::new(BoxBody::from(Body::empty()));
*resp.status_mut() = StatusCode::OK;
Ok(resp)
}
Expand Down Expand Up @@ -344,7 +343,7 @@ async fn main() -> Result<(), anyhow::Error> {

let server = DucksTarget { shutdown_tx };

let rpc_server = Server::builder()
let rpc_server = HyperServer::builder()
.add_service(IntegrationTargetServer::new(server))
.serve_with_incoming(ducks_comm);

Expand Down

0 comments on commit a36eadb

Please sign in to comment.