diff --git a/libs/proxy/tokio-postgres2/src/connection.rs b/libs/proxy/tokio-postgres2/src/connection.rs index 8c4c4427b0305..0761bf0e1e7f2 100644 --- a/libs/proxy/tokio-postgres2/src/connection.rs +++ b/libs/proxy/tokio-postgres2/src/connection.rs @@ -54,7 +54,7 @@ pub struct Connection { /// HACK: we need this in the Neon Proxy to forward params. pub parameters: HashMap, receiver: mpsc::UnboundedReceiver, - pending_responses: VecDeque, + pending_responses: Option, responses: VecDeque, state: State, } @@ -73,7 +73,7 @@ where stream, parameters, receiver, - pending_responses: VecDeque::new(), + pending_responses: None, responses: VecDeque::new(), state: State::Active, } @@ -83,7 +83,7 @@ where &mut self, cx: &mut Context<'_>, ) -> Poll>> { - if let Some(message) = self.pending_responses.pop_front() { + if let Some(message) = self.pending_responses.take() { trace!("retrying pending response"); return Poll::Ready(Some(Ok(message))); } @@ -157,7 +157,7 @@ where } Poll::Pending => { self.responses.push_front(response); - self.pending_responses.push_back(BackendMessage::Normal { + self.pending_responses = Some(BackendMessage::Normal { messages, request_complete, });