diff --git a/src/modules/account/state.rs b/src/modules/account/state.rs index 4e44bd7..01aa440 100644 --- a/src/modules/account/state.rs +++ b/src/modules/account/state.rs @@ -69,7 +69,7 @@ impl AccountRunningState { errors: vec![], is_initial_sync_completed: false, progress: None, - initial_sync_start_time: None, + initial_sync_start_time: Some(utc_now!()), initial_sync_end_time: None, initial_sync_failed_time: None, }; @@ -125,14 +125,14 @@ impl AccountRunningState { .await } - pub async fn set_initial_sync_start(account_id: u64) -> BichonResult<()> { - Self::update_account_running_state(account_id, move |current| { - let mut updated = current.clone(); - updated.initial_sync_start_time = Some(utc_now!()); - Ok(updated) - }) - .await - } + // pub async fn set_initial_sync_start(account_id: u64) -> BichonResult<()> { + // Self::update_account_running_state(account_id, move |current| { + // let mut updated = current.clone(); + // updated.initial_sync_start_time = Some(utc_now!()); + // Ok(updated) + // }) + // .await + // } pub async fn set_initial_sync_completed(account_id: u64) -> BichonResult<()> { Self::update_account_running_state(account_id, move |current| { diff --git a/src/modules/cache/imap/sync/mod.rs b/src/modules/cache/imap/sync/mod.rs index fefa9c7..76473e8 100644 --- a/src/modules/cache/imap/sync/mod.rs +++ b/src/modules/cache/imap/sync/mod.rs @@ -16,7 +16,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . - use crate::{ modules::{ account::{ @@ -46,13 +45,13 @@ pub async fn execute_imap_sync(account: &AccountModel) -> BichonResult<()> { let start_time = Instant::now(); let account_id = account.id; let sync_type = determine_sync_type(account).await?; - if matches!(sync_type, SyncType::SkipSync) { return Ok(()); } let remote_mailboxes = get_sync_folders(account).await?; if matches!(sync_type, SyncType::InitialSync) { - AccountRunningState::set_initial_sync_start(account_id).await?; + AccountRunningState::add(account.id).await?; + // AccountRunningState::set_initial_sync_start(account_id).await?; let result = match &account.date_since { Some(date_since) => { rebuild_cache_since_date(account, &remote_mailboxes, date_since).await diff --git a/src/modules/cache/imap/sync/sync_type.rs b/src/modules/cache/imap/sync/sync_type.rs index 9c3abed..ef3ebea 100644 --- a/src/modules/cache/imap/sync/sync_type.rs +++ b/src/modules/cache/imap/sync/sync_type.rs @@ -16,7 +16,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . - use crate::{ modules::{ account::{migration::AccountModel, state::AccountRunningState}, @@ -51,10 +50,7 @@ pub async fn determine_sync_type(account: &AccountModel) -> BichonResult { - AccountRunningState::add(account.id).await?; - SyncType::InitialSync - } + None => SyncType::InitialSync, }) }