Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
wip
  • Loading branch information
niclaflamme committed Aug 12, 2025
commit 9f5c10fc6a1d67b35d9e8e194951a3403ad0f6ce
5 changes: 5 additions & 0 deletions pgdog/src/frontend/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,8 @@ impl Client {

inner.stats.sent(message.len());

println!("server_message: 1");

// Release the connection back into the pool
// before flushing data to client.
// Flushing can take a minute and we don't want to block
Expand Down Expand Up @@ -693,9 +695,12 @@ impl Client {

// Pooler is offline or the client requested to disconnect and the transaction is done.
if inner.backend.done() && (inner.comms.offline() || self.shutdown) && !self.admin {
println!("i am exiting");
return Ok(true);
}

println!("i am exiting");

Ok(false)
}

Expand Down
16 changes: 14 additions & 2 deletions pgdog/src/frontend/client/test/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -514,24 +514,36 @@ async fn test_transaction_state() {

read!(conn, ['2', 'D', 'C', 'Z']);

assert!(inner.router.routed());
assert!(client.in_transaction());
// assert!(inner.router.routed());
// assert!(client.in_transaction());
assert!(inner.router.route().is_write());
println!("1.");

conn.write_all(&buffer!({ Query::new("COMMIT") }))
.await
.unwrap();

println!("2.");

client.buffer(&State::Idle).await.unwrap();

println!("2.5");

client.client_messages(inner.get()).await.unwrap();

println!("3.");

for c in ['C', 'Z'] {
println!("3.1");
let msg = inner.backend.read().await.unwrap();
assert_eq!(msg.code(), c);

println!("3.2");
client.server_message(&mut inner.get(), msg).await.unwrap();
}

println!("4.");

read!(conn, ['C', 'Z']);

assert!(!client.in_transaction());
Expand Down