From 302263b4d6de80853e72e2cab6463694fc1c3b3b Mon Sep 17 00:00:00 2001 From: Conrad Ludgate Date: Thu, 2 Jan 2025 11:05:29 +0000 Subject: [PATCH] chore(libs/proxy): remove unused notice message type --- libs/proxy/tokio-postgres2/src/connection.rs | 14 ++++---------- libs/proxy/tokio-postgres2/src/lib.rs | 5 ----- proxy/src/serverless/conn_pool.rs | 1 - proxy/src/serverless/local_conn_pool.rs | 1 - 4 files changed, 4 insertions(+), 17 deletions(-) diff --git a/libs/proxy/tokio-postgres2/src/connection.rs b/libs/proxy/tokio-postgres2/src/connection.rs index f478717e0d2d6..47c436cd44865 100644 --- a/libs/proxy/tokio-postgres2/src/connection.rs +++ b/libs/proxy/tokio-postgres2/src/connection.rs @@ -1,11 +1,10 @@ use crate::codec::{BackendMessage, BackendMessages, FrontendMessage, PostgresCodec}; -use crate::error::DbError; use crate::maybe_tls_stream::MaybeTlsStream; use crate::{AsyncMessage, Error, Notification}; use bytes::BytesMut; use fallible_iterator::FallibleIterator; use futures_util::{ready, Sink, Stream}; -use log::{info, trace}; +use log::trace; use postgres_protocol2::message::backend::Message; use postgres_protocol2::message::frontend; use std::collections::{HashMap, VecDeque}; @@ -109,9 +108,8 @@ where }; let (mut messages, request_complete) = match message { - BackendMessage::Async(Message::NoticeResponse(body)) => { - let error = DbError::parse(&mut body.fields()).map_err(Error::parse)?; - return Poll::Ready(Ok(AsyncMessage::Notice(error))); + BackendMessage::Async(Message::NoticeResponse(_)) => { + continue; } BackendMessage::Async(Message::NotificationResponse(body)) => { let notification = Notification { @@ -328,11 +326,7 @@ where type Output = Result<(), Error>; fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { - while let Some(message) = ready!(self.poll_message(cx)?) { - if let AsyncMessage::Notice(notice) = message { - info!("{}: {}", notice.severity(), notice.message()); - } - } + while ready!(self.poll_message(cx)?).is_some() {} Poll::Ready(Ok(())) } } diff --git a/libs/proxy/tokio-postgres2/src/lib.rs b/libs/proxy/tokio-postgres2/src/lib.rs index 9155dd82792a1..88abd85334712 100644 --- a/libs/proxy/tokio-postgres2/src/lib.rs +++ b/libs/proxy/tokio-postgres2/src/lib.rs @@ -6,7 +6,6 @@ pub use crate::client::{Client, SocketConfig}; pub use crate::config::Config; pub use crate::connect_raw::RawConnection; pub use crate::connection::Connection; -use crate::error::DbError; pub use crate::error::Error; pub use crate::generic_client::GenericClient; pub use crate::query::RowStream; @@ -100,10 +99,6 @@ impl Notification { #[derive(Debug, Clone)] #[non_exhaustive] pub enum AsyncMessage { - /// A notice. - /// - /// Notices use the same format as errors, but aren't "errors" per-se. - Notice(DbError), /// A notification. /// /// Connections can subscribe to notifications with the `LISTEN` command. diff --git a/proxy/src/serverless/conn_pool.rs b/proxy/src/serverless/conn_pool.rs index b35ee56728014..3561a98a505eb 100644 --- a/proxy/src/serverless/conn_pool.rs +++ b/proxy/src/serverless/conn_pool.rs @@ -124,7 +124,6 @@ pub(crate) fn poll_client( let message = ready!(connection.poll_message(cx)); match message { - Some(Ok(AsyncMessage::Notice(_))) => {} Some(Ok(AsyncMessage::Notification(notif))) => { warn!(%session_id, pid = notif.process_id(), channel = notif.channel(), "notification received"); } diff --git a/proxy/src/serverless/local_conn_pool.rs b/proxy/src/serverless/local_conn_pool.rs index fc4528807a345..304b806162fba 100644 --- a/proxy/src/serverless/local_conn_pool.rs +++ b/proxy/src/serverless/local_conn_pool.rs @@ -227,7 +227,6 @@ pub(crate) fn poll_client( let message = ready!(connection.poll_message(cx)); match message { - Some(Ok(AsyncMessage::Notice(_))) => {} Some(Ok(AsyncMessage::Notification(notif))) => { warn!(%session_id, pid = notif.process_id(), channel = notif.channel(), "notification received"); }