mirror of
https://github.com/rustmailer/bichon.git
synced 2026-08-30 01:44:23 +00:00
fix(core): carry duplicates through the import audit event
success no longer includes dedup-skipped mail, so without a duplicates field ImportPerformed consumers could not tell an all-duplicates batch from one that silently lost everything. Also documents that ExtractOutcome::Imported covers mail dropped by archive rules, which has always counted as a success.
This commit is contained in:
@@ -46,8 +46,10 @@ use crate::{
|
||||
utils::{compute_content_hash, hex_hash, html::extract_text},
|
||||
};
|
||||
|
||||
/// The outcome of extracting an envelope: either the message was imported,
|
||||
/// or it was skipped because its content hash was already archived.
|
||||
/// The outcome of extracting an envelope. `Duplicate` means the message was
|
||||
/// skipped because its content hash was already archived. `Imported` covers
|
||||
/// every other processed message, including mail dropped by archive rules,
|
||||
/// which has always counted as a success on the import surfaces.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[must_use]
|
||||
pub enum ExtractOutcome {
|
||||
|
||||
@@ -209,6 +209,7 @@ pub enum Event {
|
||||
format: String,
|
||||
total: u64,
|
||||
success: u64,
|
||||
duplicates: u64,
|
||||
failed: u64,
|
||||
},
|
||||
MailboxRemoved {
|
||||
|
||||
@@ -77,6 +77,7 @@ impl ImportApi {
|
||||
format: "eml".to_string(),
|
||||
total: result.total as u64,
|
||||
success: result.success as u64,
|
||||
duplicates: result.duplicates as u64,
|
||||
failed: result.failed as u64,
|
||||
});
|
||||
|
||||
@@ -274,6 +275,7 @@ impl ImportApi {
|
||||
format: format_str.clone(),
|
||||
total: 0,
|
||||
success: 0,
|
||||
duplicates: 0,
|
||||
failed: 0,
|
||||
});
|
||||
tokio::task::spawn_blocking(move || {
|
||||
|
||||
Reference in New Issue
Block a user