fix(managed): expose dropped subscription events
Track a monotonic discarded-event count per bounded subscription for all overflow policies, including after hub sealing or disconnection. Preserve nonblocking publication and existing queue policies. Warn once in streaming CLI output and mark TUI summaries/status as incomplete when DropOldest discarded events. Add exact overflow-counter and incomplete-marker regressions.
This commit is contained in:
4 files changed
+111
-4
No files matched your search
@@ -399,6 +399,9 @@ fn run_group_stream(
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Some(warning) = dropped_event_warning(events.dropped_events()) {
|
||||
eprintln!("{warning}");
|
||||
}
|
||||
|
||||
if outcome.end_reason == ManagedGroupEndReason::Cancelled && !interrupted {
|
||||
return Err("managed client group was cancelled".into());
|
||||
@@ -446,6 +449,14 @@ fn report_target_failure(target: &ManagedTargetOutcome) {
|
||||
}
|
||||
}
|
||||
|
||||
fn dropped_event_warning(dropped_events: u64) -> Option<String> {
|
||||
(dropped_events > 0).then(|| {
|
||||
format!(
|
||||
"irtt-rs: warning: dropped {dropped_events} managed group events; output and statistics may be incomplete"
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
fn estimated_group_completion_grace(args: &ClientArgs) -> Duration {
|
||||
let open_timeout: Duration = args.to_client_config().open_timeouts.iter().sum();
|
||||
open_timeout
|
||||
@@ -598,6 +609,14 @@ mod tests {
|
||||
OutputConfig::new(format, columns, header, verbose, false).unwrap()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn dropped_event_warning_marks_statistics_incomplete() {
|
||||
assert_eq!(dropped_event_warning(0), None);
|
||||
let warning = dropped_event_warning(7).unwrap();
|
||||
assert!(warning.contains("dropped 7 managed group events"));
|
||||
assert!(warning.contains("statistics may be incomplete"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn output_helper_streams_and_collects_events() {
|
||||
let sent_at = test_timestamp(Duration::from_secs(1));
|
||||
|
||||
Reference in new issue
Block a user