Skip to content
Merged
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
10 changes: 8 additions & 2 deletions libsql/src/database/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ cfg_replication! {
use super::SyncProtocol;
match sync_protocol {
p @ (SyncProtocol::Auto | SyncProtocol::V2) => {
tracing::trace!("Probing for sync protocol version for {}", url);
let client = hyper::client::Client::builder()
.build::<_, hyper::Body>(connector.clone());

Expand All @@ -381,6 +382,8 @@ cfg_replication! {
.await
.map_err(|err| crate::Error::Sync(err.into()))?;

tracing::trace!("Probe for sync protocol version for {} returned status {}", url, res.status());

if res.status() == http::StatusCode::UNAUTHORIZED {
return Err(crate::Error::Sync("Unauthorized".into()));
}
Expand All @@ -397,15 +400,18 @@ cfg_replication! {
}

if res.status().is_success() {
tracing::trace!("Using sync protocol v2 for {}", url);
return Builder::new_synced_database(path, url, auth_token)
.remote_writes(true)
.read_your_writes(read_your_writes)
.build()
.await;
}

tracing::trace!("Using sync protocol v1 for {} based on probe results", url);
}
SyncProtocol::V1 => {
tracing::trace!("Using sync protocol v1 for {}", url);
}
SyncProtocol::V1 => {}
}
}

Expand Down
Loading