Skip to content

Commit

Permalink
[cli] Code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
andyone committed Sep 15, 2023
1 parent 1d0c98a commit 10f1be3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 4 additions & 1 deletion cli/command_clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ func ClientsCommand(args CommandArgs) int {
req := &REDIS.Request{
Command: []string{"CLIENT", "LIST", "TYPE", "NORMAL"},
Port: CORE.GetInstancePort(id),
Auth: REDIS.Auth{CORE.REDIS_USER_ADMIN, meta.Preferencies.AdminPassword},
Auth: REDIS.Auth{
User: CORE.REDIS_USER_ADMIN,
Password: meta.Preferencies.AdminPassword,
},
Timeout: time.Second,
}

Expand Down
7 changes: 4 additions & 3 deletions cli/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,11 +472,12 @@ func warnAboutUnsafeAction(id int, message string) bool {
case 5:
ops, err := getCurrentInstanceTraffic(id)

if ops > 10 {
switch {
case ops > 10:
terminal.Warn("There is some traffic on the instance (%d ops/s).", ops)
} else if err != nil {
case err != nil:
terminal.Warn("Can't measure the number of operations on the instance.")
} else {
default:
continue
}
}
Expand Down

0 comments on commit 10f1be3

Please sign in to comment.