Skip to content

Commit

Permalink
Merge pull request #59 from Horusiath/close-oneshot-requests
Browse files Browse the repository at this point in the history
Send close request when HTTP is executed only once
  • Loading branch information
psarna committed Nov 20, 2023
2 parents 9e0421b + 2ea86e8 commit 4e715e1
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,19 @@ impl Client {
} else {
Cookie::default()
};
let requests = if tx_id != 0 {
vec![pipeline::StreamRequest::Execute(
pipeline::StreamExecuteReq { stmt },
)]
} else {
vec![
pipeline::StreamRequest::Execute(pipeline::StreamExecuteReq { stmt }),
pipeline::StreamRequest::Close,
]
};
let msg = pipeline::ClientMsg {
baton: cookie.baton,
requests: vec![pipeline::StreamRequest::Execute(
pipeline::StreamExecuteReq { stmt },
)],
requests,
};
let body = serde_json::to_string(&msg)?;
let url = cookie
Expand Down

0 comments on commit 4e715e1

Please sign in to comment.