mirror of
https://github.com/atuinsh/atuin.git
synced 2025-01-12 17:28:16 +01:00
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.
This commit is contained in:
parent
ecce55b445
commit
c2439d1ed6
@ -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(())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user