Fix Webhooks: event IDs collide for same event type emitted in the same second
This commit is contained in:
@@ -15,6 +15,7 @@ If you are upgrading from v0.16.x, replace the binary (or run `docker pull`). If
|
|||||||
- DANE: Verify DNSSEC is supported by the resolver before attempting to validate TLSA records.
|
- DANE: Verify DNSSEC is supported by the resolver before attempting to validate TLSA records.
|
||||||
- TLS: Update search index when file-backed certificates are refreshed.
|
- TLS: Update search index when file-backed certificates are refreshed.
|
||||||
- JMAP: `Principal/query` returns broad results when a `name` or `email` filter cannot be resolved.
|
- JMAP: `Principal/query` returns broad results when a `name` or `email` filter cannot be resolved.
|
||||||
|
- Webhooks: event IDs collide for same event type emitted in the same second.
|
||||||
|
|
||||||
## [0.16.10] - 2026-06-21
|
## [0.16.10] - 2026-06-21
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ use serde::{
|
|||||||
Serialize, Serializer,
|
Serialize, Serializer,
|
||||||
ser::{SerializeMap, SerializeSeq},
|
ser::{SerializeMap, SerializeSeq},
|
||||||
};
|
};
|
||||||
|
use std::sync::atomic::{AtomicU64, Ordering};
|
||||||
|
|
||||||
|
static EVENT_ID_COUNTER: AtomicU64 = AtomicU64::new(0);
|
||||||
|
|
||||||
struct Keys<'x> {
|
struct Keys<'x> {
|
||||||
keys: &'x [(Key, Value)],
|
keys: &'x [(Key, Value)],
|
||||||
@@ -83,7 +86,12 @@ impl<T: AsRef<Event<EventDetails>>> Serialize for JsonEventSerializer<T> {
|
|||||||
if self.with_id {
|
if self.with_id {
|
||||||
map.serialize_entry(
|
map.serialize_entry(
|
||||||
"id",
|
"id",
|
||||||
&format!("{}{}", event.inner.timestamp, event.inner.typ.to_id()),
|
&format!(
|
||||||
|
"{}{}{}",
|
||||||
|
event.inner.timestamp,
|
||||||
|
EVENT_ID_COUNTER.fetch_add(1, Ordering::Relaxed),
|
||||||
|
event.inner.typ.to_id()
|
||||||
|
),
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
if self.with_description {
|
if self.with_description {
|
||||||
|
|||||||
Reference in New Issue
Block a user