feat: idempotent handlers, deterministic activity ids

This commit is contained in:
2026-10-26 01:27:03 +01:00
parent 7f9c252d35
commit 4cb2972f63
11 changed files with 719 additions and 19 deletions

View File

@@ -45,6 +45,17 @@ impl EventHandler for ImageConversionHandler {
return Ok(());
}
// `get` falls back to `{key}.webp` / `{key}.avif`, which would re-encode
// an already converted image on redelivery. Probe the exact key first:
// once the original is gone, an earlier delivery finished the conversion.
match self.storage.get_stream(&key).await {
Ok(_) => {}
Err(DomainError::NotFound(_)) => {
tracing::debug!("original {key} already converted, skipping");
return Ok(());
}
Err(e) => return Err(e),
}
let bytes = self.storage.get(&key).await?;
let format = self.format;