-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
The client flush
method is implemented in terms of stopping and restarting the Transmission
:
Lines 122 to 133 in 2f7cdc8
/// flush closes and reopens the Transmission, ensuring events are sent without | |
/// waiting on the batch to be sent asyncronously. Generally, it is more efficient to | |
/// rely on asyncronous batches than to call Flush, but certain scenarios may require | |
/// Flush if asynchronous sends are not guaranteed to run (i.e. running in AWS Lambda) | |
/// Flush is not thread safe - use it only when you are sure that no other parts of | |
/// your program are calling Send | |
pub fn flush(&mut self) -> Result<()> { | |
info!("flushing libhoney client"); | |
self.transmission.stop()?; | |
self.transmission.start(); | |
Ok(()) | |
} |
Unfortunately, the stop event causes a break
that breaks out of the loop and doesn't send any of the queued events:
libhoney-rust/src/transmission.rs
Lines 212 to 215 in 62d6da9
if event.fields.contains_key("internal_stop_event") { | |
info!("got 'internal_stop_event' event"); | |
break; | |
} |
I think the code should probably jump to this line instead of breaking out of the loop:
libhoney-rust/src/transmission.rs
Line 238 in 62d6da9
let mut batches_sent = Vec::new(); |
Metadata
Metadata
Assignees
Labels
No labels