Skip to content

Commit

Permalink
Delete purge locks
Browse files Browse the repository at this point in the history
  • Loading branch information
mdecimus committed Jul 8, 2024
1 parent 82f7311 commit e2fc705
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 31 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
47 changes: 17 additions & 30 deletions crates/jmap/src/email/delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit e2fc705

Please sign in to comment.