2
0
mirror of https://github.com/hibiken/asynq.git synced 2024-12-26 07:42:17 +08:00

Minor fix in queue command

This commit is contained in:
Ken Hibino 2021-05-23 20:46:22 -07:00
parent 77604af265
commit 385323b679
2 changed files with 8 additions and 15 deletions

View File

@ -691,18 +691,12 @@ func (i *Inspector) ClusterKeySlot(qname string) (int64, error) {
// ClusterNode describes a node in redis cluster.
type ClusterNode struct {
// Node ID in the cluster.
id string
ID string
// Address of the node.
addr string
Addr string
}
// ID returns the node ID in the cluster.
func (node *ClusterNode) ID() string { return node.id }
// Addr returns the address of the node.
func (node *ClusterNode) Addr() string { return node.addr }
// ClusterNodes returns a list of nodes the given queue belongs to.
//
// Only relevant if task queues are stored in redis cluster.
@ -713,7 +707,7 @@ func (i *Inspector) ClusterNodes(qname string) ([]*ClusterNode, error) {
}
var res []*ClusterNode
for _, node := range nodes {
res = append(res, &ClusterNode{id: node.ID, addr: node.Addr})
res = append(res, &ClusterNode{ID: node.ID, Addr: node.Addr})
}
return res, nil
}

View File

@ -90,7 +90,7 @@ func queueList(cmd *cobra.Command, args []string) {
fmt.Printf("error: Could not fetch list of queues: %v\n", err)
os.Exit(1)
}
var qs []queueInfo
var qs []*queueInfo
for _, qname := range queues {
q := queueInfo{name: qname}
if useRedisCluster {
@ -107,7 +107,7 @@ func queueList(cmd *cobra.Command, args []string) {
}
q.nodes = nodes
}
qs = append(qs, q)
qs = append(qs, &q)
}
if useRedisCluster {
printTable(
@ -129,9 +129,8 @@ func queueInspect(cmd *cobra.Command, args []string) {
inspector := createInspector()
for i, qname := range args {
if i > 0 {
fmt.Printf("\n%s\n", separator)
fmt.Printf("\n%s\n\n", separator)
}
fmt.Println()
info, err := inspector.GetQueueInfo(qname)
if err != nil {
fmt.Printf("error: %v\n", err)
@ -179,9 +178,9 @@ func queueHistory(cmd *cobra.Command, args []string) {
inspector := createInspector()
for i, qname := range args {
if i > 0 {
fmt.Printf("\n%s\n", separator)
fmt.Printf("\n%s\n\n", separator)
}
fmt.Printf("\nQueue: %s\n\n", qname)
fmt.Printf("Queue: %s\n\n", qname)
stats, err := inspector.History(qname, days)
if err != nil {
fmt.Printf("error: %v\n", err)