Skip to content

Commit

Permalink
don't reload crowdsec unnecessarily if a data download fails
Browse files Browse the repository at this point in the history
  • Loading branch information
mmetc committed Mar 20, 2024
1 parent 7a08aed commit 12e5c11
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/cwhub/dataset.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ func downloadFile(url string, destPath string) error {
os.Remove(tmpFileName)
}()

// a check on stdout is used while scripting to know if the hub has been upgraded
// and a configuration reload is required
// TODO: use a better way to communicate this
fmt.Printf("updated %s\n", filepath.Base(destPath))

// avoid reading the whole file in memory
_, err = io.Copy(tmpFile, resp.Body)
if err != nil {
Expand All @@ -62,6 +57,11 @@ func downloadFile(url string, destPath string) error {
return err
}

// a check on stdout is used while scripting to know if the hub has been upgraded
// and a configuration reload is required
// TODO: use a better way to communicate this
fmt.Printf("updated %s\n", filepath.Base(destPath))

if err = os.Rename(tmpFileName, destPath); err != nil {
return err
}
Expand Down

0 comments on commit 12e5c11

Please sign in to comment.