From aa3c768c048d73ad325cdc51e7bd15927ea3a4cd Mon Sep 17 00:00:00 2001 From: Amolith Date: Tue, 31 Mar 2026 13:37:30 -0600 Subject: [PATCH] Print --recent events as we seek --recent seeks from newest events to oldest, so printing as we seek instead of batching and printing in reverse changes this flag's message ordering to mirror seek ordering: newest to oldest. --- bin/view-events | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/bin/view-events b/bin/view-events index d3a87f33badc4ca1193509af2f174a76e1619612..1939a0345c22e99146975ae2a2a5fedf32e4f16d 100755 --- a/bin/view-events +++ b/bin/view-events @@ -172,7 +172,6 @@ count = 0 if options[:recent] target = options[:recent] - matched = [] cursor = options[:end] ? to_stream_id(options[:end]) : "+" loop do @@ -181,19 +180,17 @@ if options[:recent] entries.each do |_id, fields| if matches?(fields, filters) - matched.unshift(fields) - break if matched.length >= target + puts format_event(fields, **options) + count += 1 + break if count >= target end end - break if matched.length >= target + break if count >= target cursor = prev_stream_id(entries.last[0]) break unless cursor break if entries.size < BATCH_SIZE end - - matched.each { |fields| puts format_event(fields, **options) } - count = matched.length else start_id = to_stream_id(options[:start]) end_id = options[:end] ? to_stream_id(options[:end]) : "+"