diff --git a/CHANGELOG.md b/CHANGELOG.md index 92881e05..749b967e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ To upgrade replace the `stalwart-mail` binary. ## Added - Restore deleted e-mails (Enterprise Edition only) -- Kubernetes (K8S) livenessProbe and readinessProbe endpoints +- Kubernetes (K8S) livenessProbe and readinessProbe endpoints. ### Changed - Avoid sending reports for DMARC/delivery reports (#173) diff --git a/crates/jmap/src/email/delete.rs b/crates/jmap/src/email/delete.rs index 987a44ba..de8669c6 100644 --- a/crates/jmap/src/email/delete.rs +++ b/crates/jmap/src/email/delete.rs @@ -251,36 +251,6 @@ impl JMAP { pub async fn purge_account(&self, account_id: u32) { // Lock account - match self - .core - .storage - .lookup - .counter_get(format!("purge:{account_id}").into_bytes()) - .await - { - Ok(count) => { - if count > 0 { - tracing::debug!( - event = "skipped", - context = "email_purge_account", - account_id = account_id, - count, - "Account is already being purged." - ); - return; - } - } - Err(err) => { - tracing::error!( - event = "error", - context = "email_purge_account", - account_id = account_id, - error = ?err, - "Failed to lock account." - ); - return; - } - } match self .core .storage @@ -351,6 +321,23 @@ impl JMAP { ); } } + + // Delete lock + if let Err(err) = self + .core + .storage + .lookup + .counter_delete(format!("purge:{account_id}").into_bytes()) + .await + { + tracing::error!( + event = "error", + context = "email_purge_account", + account_id = account_id, + error = ?err, + "Failed to delete lock." + ); + } } pub async fn emails_auto_expunge(