Skip to content

Commit

Permalink
chore(libs/proxy): make pending_repsonses an option instead of vecdeq…
Browse files Browse the repository at this point in the history
…ue, as it can only store 1 item
  • Loading branch information
conradludgate committed Jan 2, 2025
1 parent 729bfe2 commit e288da7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions libs/proxy/tokio-postgres2/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub struct Connection<S, T> {
/// HACK: we need this in the Neon Proxy to forward params.
pub parameters: HashMap<String, String>,
receiver: mpsc::UnboundedReceiver<Request>,
pending_responses: VecDeque<BackendMessage>,
pending_responses: Option<BackendMessage>,
responses: VecDeque<Response>,
state: State,
}
Expand All @@ -73,7 +73,7 @@ where
stream,
parameters,
receiver,
pending_responses: VecDeque::new(),
pending_responses: None,
responses: VecDeque::new(),
state: State::Active,
}
Expand All @@ -83,7 +83,7 @@ where
&mut self,
cx: &mut Context<'_>,
) -> Poll<Option<Result<BackendMessage, Error>>> {
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)));
}
Expand Down Expand Up @@ -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,
});
Expand Down

0 comments on commit e288da7

Please sign in to comment.