refactor: tidy consumption metrics (#4860)

Tidying up I've been wanting to do for some time.

Follow-up to #4857.
This commit is contained in:
Joonas Koivunen
2023-08-01 18:14:16 +03:00
committed by GitHub
parent 78fa2b13e5
commit 3a00a5deb2
5 changed files with 102 additions and 117 deletions

View File

@@ -57,7 +57,7 @@ pub struct Event<Extra> {
pub extra: Extra,
}
pub fn idempotency_key(node_id: String) -> String {
pub fn idempotency_key(node_id: &str) -> String {
format!(
"{}-{}-{:04}",
Utc::now(),
@@ -71,6 +71,6 @@ pub const CHUNK_SIZE: usize = 1000;
// Just a wrapper around a slice of events
// to serialize it as `{"events" : [ ] }
#[derive(serde::Serialize)]
pub struct EventChunk<'a, T> {
pub events: &'a [T],
pub struct EventChunk<'a, T: Clone> {
pub events: std::borrow::Cow<'a, [T]>,
}