Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hack: 😴 sleep enough for cli debug subcommands to broadcast #954

Merged
merged 2 commits into from
Jul 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions app/client/cli/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cli

import (
"os"
"time"

"github.com/manifoldco/promptui"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -50,7 +51,10 @@ func newDebugUISubCommands() []*cobra.Command {
Use: promptItem,
PersistentPreRunE: helpers.P2PDependenciesPreRunE,
Run: func(cmd *cobra.Command, _ []string) {
// TECHDEBT(#874): this is a magic number, but an alternative would be to have the p2p module wait until connections are open and to flush the message correctly
time.Sleep(500 * time.Millisecond) // give p2p module time to start
handleSelect(cmd, cmd.Use)
time.Sleep(500 * time.Millisecond) // give p2p module time to broadcast
},
ValidArgs: items,
}
Expand All @@ -61,7 +65,7 @@ func newDebugUISubCommands() []*cobra.Command {
// newDebugUICommand returns the cobra CLI for the Debug UI interface.
func newDebugUICommand() *cobra.Command {
return &cobra.Command{
Aliases: []string{"dui"},
Aliases: []string{"dui", "debug"},
Use: "DebugUI",
Short: "Debug selection ui for rapid development",
Args: cobra.MaximumNArgs(0),
Expand Down Expand Up @@ -154,7 +158,7 @@ func handleSelect(cmd *cobra.Command, selection string) {
}
broadcastDebugMessage(cmd, m)
default:
logger.Global.Error().Msg("Selection not yet implemented...")
logger.Global.Error().Str("selection", selection).Msg("Selection not yet implemented...")
}
}

Expand Down
Loading