Skip to content
Closed
Changes from all commits
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
14 changes: 7 additions & 7 deletions libsql/src/hrana/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ where

pub async fn cursor(&self, batch: Batch) -> Result<Cursor<T::Stream>> {
let mut client = self.inner.stream.lock().await;
let cursor = client.open_cursor(batch).await?;
let cursor = client.open_cursor(batch, !self.is_autocommit()).await?;
Ok(cursor)
}

Expand Down Expand Up @@ -314,7 +314,7 @@ where
Ok(resp)
}

pub async fn open_cursor(&mut self, batch: Batch) -> Result<Cursor<T::Stream>> {
pub async fn open_cursor(&mut self, batch: Batch, use_baton: bool) -> Result<Cursor<T::Stream>> {
let msg = CursorReq {
baton: self.baton.clone(),
batch,
Expand All @@ -330,14 +330,14 @@ where
self.cursor_url = Arc::from(format!("{base_url}/v3/cursor"));
}
match response.baton.take() {
None => {
tracing::trace!("client stream has been closed by the server");
self.reset();
} // stream has been closed by the server
Some(baton) => {
Some(baton) if use_baton => {
tracing::trace!("client stream has been assigned with baton: `{}`", baton);
self.baton = Some(baton)
}
_ => {
tracing::trace!("client stream has been closed by the server");
self.reset();
}
}
Ok(cursor)
}
Expand Down
Loading