Skip to content

Commit 4a15532

Browse files
author
Andrew Farries
committed
Add schedule flag to run command
To allow overriding the default scheduler when testing the reconciler locally. Change default to 1 hour.
1 parent 4ff0c7e commit 4a15532

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

components/usage/cmd/run.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ func run() *cobra.Command {
2424
var (
2525
verbose bool
2626
apiKeyFile string
27+
schedule time.Duration
2728
)
2829

2930
cmd := &cobra.Command{
@@ -48,7 +49,7 @@ func run() *cobra.Command {
4849
log.WithError(err).Fatal("Failed to initialize stripe client.")
4950
}
5051

51-
ctrl, err := controller.New(1*time.Minute, controller.NewUsageReconciler(conn))
52+
ctrl, err := controller.New(schedule, controller.NewUsageReconciler(conn))
5253
if err != nil {
5354
log.WithError(err).Fatal("Failed to initialize usage controller.")
5455
}
@@ -72,6 +73,7 @@ func run() *cobra.Command {
7273
}
7374

7475
cmd.Flags().BoolVar(&verbose, "verbose", false, "Toggle verbose logging (debug level)")
76+
cmd.Flags().DurationVar(&schedule, "schedule", 1*time.Hour, "The schedule on which the reconciler should run")
7577
cmd.Flags().StringVar(&apiKeyFile, "api-key-file", "/stripe-secret/apikeys", "Location of the stripe credentials file on disk")
7678

7779
return cmd

0 commit comments

Comments
 (0)