mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-08 10:27:46 +08:00
fix(usage): preserve full bodies before queue truncation
This commit is contained in:
@@ -104,6 +104,13 @@ impl UsageQueue {
|
||||
|
||||
pub async fn enqueue(&self, event: &UsageEvent) -> Result<String, DataLayerError> {
|
||||
let encoded = self.encode_event(event)?;
|
||||
self.enqueue_encoded(encoded).await
|
||||
}
|
||||
|
||||
pub(crate) async fn enqueue_encoded(
|
||||
&self,
|
||||
encoded: EncodedUsageEvent,
|
||||
) -> Result<String, DataLayerError> {
|
||||
self.runner
|
||||
.append_fields_with_maxlen(
|
||||
&self.stream,
|
||||
@@ -117,7 +124,10 @@ impl UsageQueue {
|
||||
self.encode_event(event).map(|_| ())
|
||||
}
|
||||
|
||||
fn encode_event(&self, event: &UsageEvent) -> Result<EncodedUsageEvent, DataLayerError> {
|
||||
pub(crate) fn encode_event(
|
||||
&self,
|
||||
event: &UsageEvent,
|
||||
) -> Result<EncodedUsageEvent, DataLayerError> {
|
||||
let encoded = match event.to_bounded_stream_fields(self.config.queue_payload_max_bytes) {
|
||||
Ok(encoded) => encoded,
|
||||
Err(error) => {
|
||||
|
||||
Reference in New Issue
Block a user