mirror of
https://github.com/hibiken/asynq.git
synced 2025-10-03 05:12:01 +08:00
(cli): Add --refresh flag to dash command
This commit is contained in:
@@ -5,18 +5,22 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/MakeNowJust/heredoc/v2"
|
||||
"github.com/hibiken/asynq/tools/asynq/cmd/dash"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
flagDebug = false
|
||||
flagUseRealData = false
|
||||
flagDebug = false
|
||||
flagUseRealData = false
|
||||
flagPollInterval = 8 * time.Second
|
||||
)
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(dashCmd)
|
||||
dashCmd.Flags().DurationVar(&flagPollInterval, "refresh", 8*time.Second, "Interval between data refresh")
|
||||
// TODO: Remove this debug once we're done
|
||||
dashCmd.Flags().BoolVar(&flagDebug, "debug", false, "Print debug info")
|
||||
dashCmd.Flags().BoolVar(&flagUseRealData, "realdata", true, "Use real data in redis")
|
||||
@@ -30,8 +34,9 @@ var dashCmd = &cobra.Command{
|
||||
Args: cobra.NoArgs,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
dash.Run(dash.Options{
|
||||
DebugMode: flagDebug,
|
||||
UseRealData: flagUseRealData,
|
||||
DebugMode: flagDebug,
|
||||
UseRealData: flagUseRealData,
|
||||
PollInterval: flagPollInterval,
|
||||
})
|
||||
},
|
||||
}
|
||||
|
@@ -77,7 +77,6 @@ func Run(opts Options) {
|
||||
os.Exit(1)
|
||||
}
|
||||
s.SetStyle(baseStyle) // set default text style
|
||||
opts.PollInterval = 2 * time.Second
|
||||
|
||||
var (
|
||||
state = State{} // confined in this goroutine only; DO NOT SHARE
|
||||
|
Reference in New Issue
Block a user