Skip to content

Commit

Permalink
in progress of adding a no flush flag
Browse files Browse the repository at this point in the history
  • Loading branch information
danwt committed May 16, 2024
1 parent 268b90d commit 7c11968
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
14 changes: 14 additions & 0 deletions cmd/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,20 @@ func flushIntervalFlag(v *viper.Viper, cmd *cobra.Command) *cobra.Command {
return cmd
}

func noFlushFlag(v *viper.Viper, cmd *cobra.Command) *cobra.Command {
cmd.Flags().Bool(
"no-flush",
false,
"avoid flushing entirely (normal behavior is to flush once at start and then on interval)",
)

if err := v.BindPFlag("no-flush", cmd.Flags().Lookup("no-flush")); err != nil {
panic(err)
}

return cmd
}

func memoFlag(v *viper.Viper, cmd *cobra.Command) *cobra.Command {
cmd.Flags().String(flagMemo, "", "a memo to include in relayed packets")
if err := v.BindPFlag(flagMemo, cmd.Flags().Lookup(flagMemo)); err != nil {
Expand Down
8 changes: 8 additions & 0 deletions cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,13 @@ $ %s start demo-path2 --max-tx-size 10`, appName, appName, appName, appName)),
return err
}

noFlush, err := cmd.Flags().GetBool("no-flush")
// TODO: us eit
_ = noFlush
if err != nil {
return err
}

stuckPacket, err := parseStuckPacketFromFlags(cmd)
if err != nil {
return err
Expand Down Expand Up @@ -192,6 +199,7 @@ $ %s start demo-path2 --max-tx-size 10`, appName, appName, appName, appName)),
cmd = processorFlag(a.viper, cmd)
cmd = initBlockFlag(a.viper, cmd)
cmd = flushIntervalFlag(a.viper, cmd)
cmd = noFlushFlag(a.viper, cmd)
cmd = memoFlag(a.viper, cmd)
cmd = stuckPacketFlags(a.viper, cmd)
return cmd
Expand Down

0 comments on commit 7c11968

Please sign in to comment.