Skip to content

Commit

Permalink
make backfill a positive duration
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrea Spacca committed Dec 8, 2023
1 parent 52e3c59 commit 9017170
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions cmd/benchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ func getStreamCommand() *cobra.Command {

cmd.Flags().StringP(cobraext.BenchNameFlagName, "", "", cobraext.BenchNameFlagDescription)
cmd.Flags().String(cobraext.VariantFlagName, "", cobraext.VariantFlagDescription)
cmd.Flags().DurationP(cobraext.BenchStreamBackFillFlagName, "", -15*time.Minute, cobraext.BenchStreamBackFillFlagDescription)
cmd.Flags().DurationP(cobraext.BenchStreamBackFillFlagName, "", 15*time.Minute, cobraext.BenchStreamBackFillFlagDescription)
cmd.Flags().Uint64P(cobraext.BenchStreamEventsPerPeriodFlagName, "", 10, cobraext.BenchStreamEventsPerPeriodFlagDescription)
cmd.Flags().DurationP(cobraext.BenchStreamPeriodDurationFlagName, "", 10*time.Second, cobraext.BenchStreamPeriodDurationFlagDescription)
cmd.Flags().BoolP(cobraext.BenchStreamPerformCleanupFlagName, "", false, cobraext.BenchStreamPerformCleanupFlagDescription)
Expand All @@ -437,8 +437,8 @@ func streamCommandAction(cmd *cobra.Command, args []string) error {
return cobraext.FlagParsingError(err, cobraext.BenchStreamBackFillFlagName)
}

if backFill > 0 {
return cobraext.FlagParsingError(errors.New("cannot be a positive duration"), cobraext.BenchStreamBackFillFlagName)
if backFill < 0 {
return cobraext.FlagParsingError(errors.New("cannot be a negative duration"), cobraext.BenchStreamBackFillFlagName)
}

eventsPerPeriod, err := cmd.Flags().GetUint64(cobraext.BenchStreamEventsPerPeriodFlagName)
Expand Down
2 changes: 1 addition & 1 deletion internal/benchrunner/runners/stream/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func WithProfile(p *profile.Profile) OptionFunc {

func WithBackFill(d time.Duration) OptionFunc {
return func(opts *Options) {
opts.BackFill = d
opts.BackFill = -1 * d
}
}

Expand Down
2 changes: 1 addition & 1 deletion internal/cobraext/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const (
BenchCorpusRallyUseCorpusAtPathFlagDescription = "path of the corpus to use for the benchmark: if present no new corpus will be generated"

BenchStreamBackFillFlagName = "backfill"
BenchStreamBackFillFlagDescription = "amount of time to ingest events for since starting from now: expressed as a negative duration"
BenchStreamBackFillFlagDescription = "amount of time to ingest events for, starting before now: expressed as a positive duration"

BenchStreamEventsPerPeriodFlagName = "events-per-period"
BenchStreamEventsPerPeriodFlagDescription = "number of events to ingest at every ingestion cycle"
Expand Down

0 comments on commit 9017170

Please sign in to comment.