Improve message layout

This commit is contained in:
2026-02-16 23:28:28 +00:00
parent f3ced1bfd8
commit 073a5b0d0c
2 changed files with 53 additions and 2 deletions

View File

@@ -730,6 +730,8 @@ def _serialize_messages_with_artifacts(
for item in serialized:
item["gap_fragments"] = []
item["metric_fragments"] = []
item["block_gap_ms"] = None
item["block_gap_display"] = ""
counterpart_identifiers = set(counterpart_identifiers or [])
snapshot = (
@@ -749,6 +751,17 @@ def _serialize_messages_with_artifacts(
current_outgoing = _message_is_outgoing_for_analysis(
msg, counterpart_identifiers
)
if (
prev_msg is not None
and prev_ts is not None
and prev_outgoing is not None
and current_outgoing == prev_outgoing
and current_ts >= prev_ts
):
block_gap_ms = current_ts - prev_ts
serialized[idx]["block_gap_ms"] = int(block_gap_ms)
serialized[idx]["block_gap_display"] = _format_gap_duration(block_gap_ms)
if (
prev_msg is not None
and prev_ts is not None