mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
Add a scanner error check to ClusterCounter.Count.
It was silently exiting at the "recordingStart":"2022-09-23T17:06:59.680537075Z" line, the first line whose length (66873) exceeds bufio.MaxScanTokenSize. Now distinctcounter exits with an error status instead of reporting partial results. $ ./distinctcounter -from 2023-01-01T00:00:00Z -to 2023-01-10T00:00:00Z -in metrics-ip-salted.jsonl 2023/04/20 13:54:11 unable to count:bufio.Scanner: token too long
This commit is contained in:
parent
f723cf52e8
commit
8e5ea82611
1 changed files with 4 additions and 0 deletions
|
@ -55,6 +55,10 @@ func (c ClusterCounter) Count(reader io.Reader) (*ClusterCountResult, error) {
|
|||
return nil, err
|
||||
}
|
||||
}
|
||||
err = inputScanner.Err()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
result.Sum = counter.Count()
|
||||
return &result, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue