mirror of
https://github.com/tursodatabase/libsql.git
synced 2025-05-04 08:31:52 +00:00
libsql: Improve sync protocol probe tracing (#1994)
This commit is contained in:
@ -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());
|
||||
|
||||
@ -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()));
|
||||
}
|
||||
@ -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 => {}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user