From 46b586e152796b997d19d8c00cb29cabf1ef2e91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Bj=C3=A4reholt?= Date: Thu, 17 Oct 2024 19:16:58 +0200 Subject: [PATCH] refactor: renamed wait_for_server to wait_for_start (same as in aw-client-python) --- aw-client-rust/src/blocking.rs | 4 ++-- aw-client-rust/src/lib.rs | 5 +++-- aw-sync/src/sync_wrapper.rs | 4 +--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/aw-client-rust/src/blocking.rs b/aw-client-rust/src/blocking.rs index 6a688ee4..ee7822bc 100644 --- a/aw-client-rust/src/blocking.rs +++ b/aw-client-rust/src/blocking.rs @@ -80,7 +80,7 @@ impl AwClient { proxy_method!(get_event_count, i64, bucketname: &str); proxy_method!(get_info, aw_models::Info,); - pub fn wait_for_server(&self) -> Result<(), Box> { - self.client.wait_for_server() + pub fn wait_for_start(&self) -> Result<(), Box> { + self.client.wait_for_start() } } diff --git a/aw-client-rust/src/lib.rs b/aw-client-rust/src/lib.rs index c481f67a..f57d1422 100644 --- a/aw-client-rust/src/lib.rs +++ b/aw-client-rust/src/lib.rs @@ -225,9 +225,10 @@ impl AwClient { } // TODO: make async - pub fn wait_for_server(&self) -> Result<(), Box> { + pub fn wait_for_start(&self) -> Result<(), Box> { let socket_addrs = self.baseurl.socket_addrs(|| None)?; - let socket_addr = socket_addrs.first() + let socket_addr = socket_addrs + .first() .ok_or("Unable to resolve baseurl into socket address")?; // Check if server is running with exponential backoff diff --git a/aw-sync/src/sync_wrapper.rs b/aw-sync/src/sync_wrapper.rs index 49c1ae85..13007779 100644 --- a/aw-sync/src/sync_wrapper.rs +++ b/aw-sync/src/sync_wrapper.rs @@ -1,7 +1,5 @@ use std::error::Error; use std::fs; -use std::net::TcpStream; -use std::time::Duration; use crate::sync::{sync_run, SyncMode, SyncSpec}; use aw_client_rust::blocking::AwClient; @@ -15,7 +13,7 @@ pub fn pull_all(client: &AwClient) -> Result<(), Box> { } pub fn pull(host: &str, client: &AwClient) -> Result<(), Box> { - client.wait_for_server()?; + client.wait_for_start()?; // Path to the sync folder // Sync folder is structured ./{hostname}/{device_id}/test.db