Delete purge locks

This commit is contained in:
mdecimus 2024-07-08 15:53:14 +02:00
parent 82f7311a4d
commit e2fc705ad7
2 changed files with 18 additions and 31 deletions

View file

@ -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)

View file

@ -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(