Skip to content

Commit

Permalink
chore(libs/proxy): remove unused notice message type
Browse files Browse the repository at this point in the history
  • Loading branch information
conradludgate committed Jan 2, 2025
1 parent 7ed97c8 commit 302263b
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 17 deletions.
14 changes: 4 additions & 10 deletions libs/proxy/tokio-postgres2/src/connection.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -328,11 +326,7 @@ where
type Output = Result<(), Error>;

fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Error>> {
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(()))
}
}
5 changes: 0 additions & 5 deletions libs/proxy/tokio-postgres2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion proxy/src/serverless/conn_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ pub(crate) fn poll_client<C: ClientInnerExt>(
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");
}
Expand Down
1 change: 0 additions & 1 deletion proxy/src/serverless/local_conn_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ pub(crate) fn poll_client<C: ClientInnerExt>(
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");
}
Expand Down

0 comments on commit 302263b

Please sign in to comment.