Skip to content

Commit 12b82a9

Browse files
committed
refactor: simplify record counting and initialization comments
1 parent 48913c3 commit 12b82a9

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

examples/parse_single_file_parallel.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,7 @@ fn main() {
9393
let parser = BgpkitParser::new(local_path.to_str().unwrap()).expect("failed to create parser");
9494
let mut raw_iter = parser.into_raw_record_iter();
9595

96-
// Track whether we've consumed the first record (PeerIndexTable) so metrics include it.
97-
let mut consumed_first_record = false;
96+
// Consume first record (PeerIndexTable) for Elementor; metrics will include it.
9897

9998
// Elementor requires the peer index table for TableDumpV2
10099
let mut elementor = Elementor::new();
@@ -105,7 +104,6 @@ fn main() {
105104
elementor
106105
.set_peer_table(record)
107106
.expect("first record is not a PeerIndexTable; this example expects a RIB file");
108-
consumed_first_record = true;
109107
} else {
110108
eprintln!("empty input: no records found");
111109
return;
@@ -123,9 +121,7 @@ fn main() {
123121
let records_parsed = Arc::new(AtomicU64::new(0));
124122

125123
// Include the initial PeerIndexTable record in the records count for consistency with parse-only runs.
126-
if consumed_first_record {
127-
records_parsed.fetch_add(1, Ordering::Relaxed);
128-
}
124+
records_parsed.fetch_add(1, Ordering::Relaxed);
129125

130126
// Channels: batches of RawMrtRecord
131127
let (batch_tx, batch_rx) = channel::bounded::<Vec<RawMrtRecord>>(chan_cap);

0 commit comments

Comments
 (0)