Skip to content

Commit

Permalink
refactor: renamed wait_for_server to wait_for_start (same as in aw-cl…
Browse files Browse the repository at this point in the history
…ient-python)
  • Loading branch information
ErikBjare committed Oct 17, 2024
1 parent 4723f32 commit 46b586e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions aw-client-rust/src/blocking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<dyn Error>> {
self.client.wait_for_server()
pub fn wait_for_start(&self) -> Result<(), Box<dyn Error>> {
self.client.wait_for_start()
}
}
5 changes: 3 additions & 2 deletions aw-client-rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,10 @@ impl AwClient {
}

// TODO: make async
pub fn wait_for_server(&self) -> Result<(), Box<dyn Error>> {
pub fn wait_for_start(&self) -> Result<(), Box<dyn Error>> {
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
Expand Down
4 changes: 1 addition & 3 deletions aw-sync/src/sync_wrapper.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -15,7 +13,7 @@ pub fn pull_all(client: &AwClient) -> Result<(), Box<dyn Error>> {
}

pub fn pull(host: &str, client: &AwClient) -> Result<(), Box<dyn Error>> {
client.wait_for_server()?;
client.wait_for_start()?;

// Path to the sync folder
// Sync folder is structured ./{hostname}/{device_id}/test.db
Expand Down

0 comments on commit 46b586e

Please sign in to comment.