From 729bfe20ec1466a6a88e27616d271e237a004921 Mon Sep 17 00:00:00 2001 From: Conrad Ludgate Date: Thu, 2 Jan 2025 11:09:33 +0000 Subject: [PATCH] chore(libs/proxy): do not propagate notices as pending_responses to postgres connection --- libs/proxy/tokio-postgres2/src/connect.rs | 12 ++---------- libs/proxy/tokio-postgres2/src/connection.rs | 3 +-- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/libs/proxy/tokio-postgres2/src/connect.rs b/libs/proxy/tokio-postgres2/src/connect.rs index e0cb69748d509..29548afcc623f 100644 --- a/libs/proxy/tokio-postgres2/src/connect.rs +++ b/libs/proxy/tokio-postgres2/src/connect.rs @@ -1,11 +1,9 @@ use crate::client::SocketConfig; -use crate::codec::BackendMessage; use crate::config::Host; use crate::connect_raw::connect_raw; use crate::connect_socket::connect_socket; use crate::tls::{MakeTlsConnect, TlsConnect}; use crate::{Client, Config, Connection, Error, RawConnection}; -use postgres_protocol2::message::backend::Message; use tokio::net::TcpStream; use tokio::sync::mpsc; @@ -43,7 +41,7 @@ where let RawConnection { stream, parameters, - delayed_notice, + delayed_notice: _, process_id, secret_key, } = connect_raw(socket, tls, config).await?; @@ -63,13 +61,7 @@ where secret_key, ); - // delayed notices are always sent as "Async" messages. - let delayed = delayed_notice - .into_iter() - .map(|m| BackendMessage::Async(Message::NoticeResponse(m))) - .collect(); - - let connection = Connection::new(stream, delayed, parameters, receiver); + let connection = Connection::new(stream, parameters, receiver); Ok((client, connection)) } diff --git a/libs/proxy/tokio-postgres2/src/connection.rs b/libs/proxy/tokio-postgres2/src/connection.rs index 47c436cd44865..8c4c4427b0305 100644 --- a/libs/proxy/tokio-postgres2/src/connection.rs +++ b/libs/proxy/tokio-postgres2/src/connection.rs @@ -66,7 +66,6 @@ where { pub(crate) fn new( stream: Framed, PostgresCodec>, - pending_responses: VecDeque, parameters: HashMap, receiver: mpsc::UnboundedReceiver, ) -> Connection { @@ -74,7 +73,7 @@ where stream, parameters, receiver, - pending_responses, + pending_responses: VecDeque::new(), responses: VecDeque::new(), state: State::Active, }