Skip to content

Commit

Permalink
Parse payload before potentially skipping (#63)
Browse files Browse the repository at this point in the history
If the rank is different, we try to skip the row in the tlparse, but we
need to consume the attached payload first, or else the payload will
fail to parse as a new line.
  • Loading branch information
jamesjwu authored Aug 8, 2024
1 parent 447b11a commit 6c6e3c3
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,21 +291,6 @@ pub fn parse_path(path: &PathBuf, config: ParseConfig) -> anyhow::Result<ParseOu
continue;
};

match expected_rank {
Some(rank) => {
if rank != e.rank {
stats.other_rank += 1;
continue;
}
}
None => {
multi.suspend(|| {
eprintln!("Detected rank: {:?}", e.rank);
});
expected_rank = Some(e.rank);
}
};

let mut payload = String::new();
if let Some(ref expect) = e.has_payload {
let mut first = true;
Expand Down Expand Up @@ -333,6 +318,21 @@ pub fn parse_path(path: &PathBuf, config: ParseConfig) -> anyhow::Result<ParseOu
}
}

match expected_rank {
Some(rank) => {
if rank != e.rank {
stats.other_rank += 1;
continue;
}
}
None => {
multi.suspend(|| {
eprintln!("Detected rank: {:?}", e.rank);
});
expected_rank = Some(e.rank);
}
};

stats.ok += 1;

// lol this clone, probably shouldn't use entry
Expand Down

0 comments on commit 6c6e3c3

Please sign in to comment.