summaryrefslogtreecommitdiffstats
path: root/atuin-client
diff options
context:
space:
mode:
authorEllie Huxtable <ellie@elliehuxtable.com>2024-01-15 13:10:10 +0000
committerGitHub <noreply@github.com>2024-01-15 13:10:10 +0000
commitc2439d1ed6fc3e973371b76637c08eea0a8f60c8 (patch)
tree31058acb291ed1b5b580d9defdaeb557c02c41c0 /atuin-client
parentecce55b445dd782aed0f38a05724eeba0653f379 (diff)
fix(sync): save sync time when it starts, not ends (#1573)
Imagine the scenario where a sync fails. The function touched here will never save the sync time. That means that external to this function, the sync never happened. The next command will try and start one immediately. The happy scenario is that this succeeds. The unhappy scenario is that this fails. Fails, and isn't saved, so we try again... Should add proper backoff but this is a good start.
Diffstat (limited to 'atuin-client')
-rw-r--r--atuin-client/src/sync.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/atuin-client/src/sync.rs b/atuin-client/src/sync.rs
index 99b423c2c..1f0d3dd81 100644
--- a/atuin-client/src/sync.rs
+++ b/atuin-client/src/sync.rs
@@ -196,6 +196,8 @@ pub async fn sync(settings: &Settings, force: bool, db: &(impl Database + Send))
settings.network_timeout,
)?;
+ Settings::save_sync_time()?;
+
let key = load_key(settings)?; // encryption key
sync_upload(&key, force, &client, db).await?;
@@ -204,7 +206,5 @@ pub async fn sync(settings: &Settings, force: bool, db: &(impl Database + Send))
debug!("sync downloaded {}", download.0);
- Settings::save_sync_time()?;
-
Ok(())
}