Skip to content

Commit

Permalink
Resolves #459 - Add message to use --ignore-errors with --repeat
Browse files Browse the repository at this point in the history
  • Loading branch information
steve-r-west committed Aug 10, 2024
1 parent 7ce9bf7 commit 3728462
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,11 @@ epcc runbooks run misc get-store-info

## Development Tips

### Retries vs Ignoring Errors

Retries in epcc-cli will retry the _exact_ rendered request so if you are using templated parameters i.e., `auto-fill` and the failure is deterministic (say a unique constraint),
a retry will just get stuck in a loop. In this case if you want to create many different records, you want to `--ignore-errors`.

### Fast rebuilds

For development the following command using [Reflex](https://github.com/cespare/reflex) can speed up your development time, by recreating the command line tool.
Expand Down
4 changes: 4 additions & 0 deletions cmd/repeater.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cmd

import (
"github.com/elasticpath/epcc-cli/external/httpclient"
"github.com/elasticpath/epcc-cli/external/shutdown"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
Expand All @@ -16,6 +17,9 @@ func repeater(c func(*cobra.Command, []string) error, repeat, repeatDelay uint32
if ignoreErrors {
log.Debugf("Ignored error %v", ignoreErrors)
} else {
if repeat > 1 && !ignoreErrors && httpclient.RetryAllErrors {
log.Infof("If you want to continue repeating even if the requests gets a 4xx you should use `--ignore-errors.`")
}
return err
}
}
Expand Down

0 comments on commit 3728462

Please sign in to comment.