Skip to content

Commit

Permalink
chore(libs/proxy): do not propagate notices as pending_responses to p…
Browse files Browse the repository at this point in the history
…ostgres connection
  • Loading branch information
conradludgate committed Jan 2, 2025
1 parent 302263b commit 729bfe2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
12 changes: 2 additions & 10 deletions libs/proxy/tokio-postgres2/src/connect.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down Expand Up @@ -43,7 +41,7 @@ where
let RawConnection {
stream,
parameters,
delayed_notice,
delayed_notice: _,
process_id,
secret_key,
} = connect_raw(socket, tls, config).await?;
Expand All @@ -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))
}
3 changes: 1 addition & 2 deletions libs/proxy/tokio-postgres2/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,14 @@ where
{
pub(crate) fn new(
stream: Framed<MaybeTlsStream<S, T>, PostgresCodec>,
pending_responses: VecDeque<BackendMessage>,
parameters: HashMap<String, String>,
receiver: mpsc::UnboundedReceiver<Request>,
) -> Connection<S, T> {
Connection {
stream,
parameters,
receiver,
pending_responses,
pending_responses: VecDeque::new(),
responses: VecDeque::new(),
state: State::Active,
}
Expand Down

0 comments on commit 729bfe2

Please sign in to comment.