Skip to content

Commit

Permalink
chore: adds logging and skips file on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
Aasish Rampalli committed Sep 10, 2024
1 parent 0962e07 commit 22f7603
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/fanal/walker/cached_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,15 @@ func (o *cachedFile) Open() (xio.ReadSeekCloserAt, error) {
for i := 0; i < 3; i++ {
b, err = io.ReadAll(o.reader)
if err == io.ErrUnexpectedEOF {
fmt.Println("Got unexpected EOF error. Retrying after 5 seconds")
fmt.Printf("Got unexpected EOF error on file %s after downloading %n bytes. Retrying after 5 seconds\n", o.filePath, len(b))
time.Sleep(5 * time.Second)
continue
}
break
}
if err != nil {
if err == io.ErrUnexpectedEOF {
fmt.Printf("Retries didn't solve issue. Skipping file %s\n", o.filePath)
} else if err != nil {
o.err = xerrors.Errorf("unable to read the file: %w", err)
return
}
Expand Down

0 comments on commit 22f7603

Please sign in to comment.