mirror of
https://github.com/atuinsh/atuin.git
synced 2025-02-17 19:01:22 +01:00
wip
This commit is contained in:
parent
bf45eabe8b
commit
2a47234a78
@ -234,6 +234,13 @@ impl<'a> Client<'a> {
|
||||
start: Option<RecordId>,
|
||||
count: u64,
|
||||
) -> Result<Vec<Record<EncryptedData>>> {
|
||||
debug!(
|
||||
"fetching record/s from host {}/{}/{}",
|
||||
host.0.to_string(),
|
||||
tag,
|
||||
start.map_or(String::from("empty"), |f| f.0.to_string())
|
||||
);
|
||||
|
||||
let url = format!(
|
||||
"{}/record/next?host={}&tag={}&count={}",
|
||||
self.sync_addr, host.0, tag, count
|
||||
@ -264,6 +271,8 @@ impl<'a> Client<'a> {
|
||||
let resp = self.client.get(url).send().await?;
|
||||
let index = resp.json().await?;
|
||||
|
||||
debug!("got remote index {:?}", index);
|
||||
|
||||
Ok(index)
|
||||
}
|
||||
|
||||
|
@ -166,7 +166,7 @@ async fn sync_download(
|
||||
op: (HostId, String, RecordId),
|
||||
) -> Result<i64> {
|
||||
// TODO(ellie): implement variable page sizing like on history sync
|
||||
let download_page_size = 1000;
|
||||
let download_page_size = 1;
|
||||
|
||||
let mut total = 0;
|
||||
|
||||
@ -185,7 +185,7 @@ async fn sync_download(
|
||||
// In this case, that contains the remote tail.
|
||||
assert_eq!(remote_tail, op.2);
|
||||
|
||||
println!("Downloading {:?}/{}/{:?} to local", op.0, op.1, op.2);
|
||||
debug!("Downloading {:?}/{}/{:?} to local", op.0, op.1, op.2);
|
||||
|
||||
let mut records = client
|
||||
.next_records(
|
||||
@ -196,6 +196,8 @@ async fn sync_download(
|
||||
)
|
||||
.await?;
|
||||
|
||||
debug!("received {} records from remote", records.len());
|
||||
|
||||
while !records.is_empty() {
|
||||
total += std::cmp::min(download_page_size, records.len() as u64);
|
||||
store.push_batch(records.iter()).await?;
|
||||
|
@ -84,7 +84,7 @@ async fn run(
|
||||
|
||||
println!("{uploaded}/{downloaded} up/down to record store");
|
||||
|
||||
atuin_client::sync::sync(settings, force, db).await?;
|
||||
//atuin_client::sync::sync(settings, force, db).await?;
|
||||
|
||||
println!(
|
||||
"Sync complete! {} items in history database, force: {}",
|
||||
|
Loading…
Reference in New Issue
Block a user