aboutsummaryrefslogtreecommitdiffstats
path: root/crates/atuin-daemon/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/atuin-daemon/src')
-rw-r--r--crates/atuin-daemon/src/server.rs2
-rw-r--r--crates/atuin-daemon/src/server/sync.rs14
2 files changed, 12 insertions, 4 deletions
diff --git a/crates/atuin-daemon/src/server.rs b/crates/atuin-daemon/src/server.rs
index ce864343..2cba1753 100644
--- a/crates/atuin-daemon/src/server.rs
+++ b/crates/atuin-daemon/src/server.rs
@@ -254,7 +254,7 @@ pub async fn listen(
.context("could not load encryption key")?
.into();
- let host_id = Settings::host_id().expect("failed to get host_id");
+ let host_id = Settings::host_id().await?;
let history_store = HistoryStore::new(store.clone(), host_id, encryption_key);
let history = HistoryService::new(history_store.clone(), history_db.clone());
diff --git a/crates/atuin-daemon/src/server/sync.rs b/crates/atuin-daemon/src/server/sync.rs
index 3aa5dec3..e1e49597 100644
--- a/crates/atuin-daemon/src/server/sync.rs
+++ b/crates/atuin-daemon/src/server/sync.rs
@@ -21,7 +21,7 @@ pub async fn worker(
tracing::info!("booting sync worker");
let encryption_key: [u8; 32] = encryption::load_key(&settings)?.into();
- let host_id = Settings::host_id().expect("failed to get host_id");
+ let host_id = Settings::host_id().await?;
let alias_store = AliasStore::new(store.clone(), host_id, encryption_key);
let var_store = VarStore::new(store.clone(), host_id, encryption_key);
@@ -38,7 +38,15 @@ pub async fn worker(
ticker.tick().await;
tracing::info!("sync worker tick");
- if !settings.logged_in() {
+ let logged_in = match settings.logged_in().await {
+ Ok(v) => v,
+ Err(e) => {
+ tracing::warn!("failed to check login status, skipping sync tick: {e}");
+ continue;
+ }
+ };
+
+ if !logged_in {
tracing::debug!("not logged in, skipping sync tick");
continue;
}
@@ -82,7 +90,7 @@ pub async fn worker(
}
// store sync time
- tokio::task::spawn_blocking(Settings::save_sync_time).await??;
+ Settings::save_sync_time().await?;
}
}
}