mirror of
https://github.com/hibiken/asynq.git
synced 2024-11-10 11:31:58 +08:00
Minor fix in queue command
This commit is contained in:
parent
77604af265
commit
385323b679
12
inspector.go
12
inspector.go
@ -691,18 +691,12 @@ func (i *Inspector) ClusterKeySlot(qname string) (int64, error) {
|
|||||||
// ClusterNode describes a node in redis cluster.
|
// ClusterNode describes a node in redis cluster.
|
||||||
type ClusterNode struct {
|
type ClusterNode struct {
|
||||||
// Node ID in the cluster.
|
// Node ID in the cluster.
|
||||||
id string
|
ID string
|
||||||
|
|
||||||
// Address of the node.
|
// 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.
|
// ClusterNodes returns a list of nodes the given queue belongs to.
|
||||||
//
|
//
|
||||||
// Only relevant if task queues are stored in redis cluster.
|
// 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
|
var res []*ClusterNode
|
||||||
for _, node := range nodes {
|
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
|
return res, nil
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ func queueList(cmd *cobra.Command, args []string) {
|
|||||||
fmt.Printf("error: Could not fetch list of queues: %v\n", err)
|
fmt.Printf("error: Could not fetch list of queues: %v\n", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
var qs []queueInfo
|
var qs []*queueInfo
|
||||||
for _, qname := range queues {
|
for _, qname := range queues {
|
||||||
q := queueInfo{name: qname}
|
q := queueInfo{name: qname}
|
||||||
if useRedisCluster {
|
if useRedisCluster {
|
||||||
@ -107,7 +107,7 @@ func queueList(cmd *cobra.Command, args []string) {
|
|||||||
}
|
}
|
||||||
q.nodes = nodes
|
q.nodes = nodes
|
||||||
}
|
}
|
||||||
qs = append(qs, q)
|
qs = append(qs, &q)
|
||||||
}
|
}
|
||||||
if useRedisCluster {
|
if useRedisCluster {
|
||||||
printTable(
|
printTable(
|
||||||
@ -129,9 +129,8 @@ func queueInspect(cmd *cobra.Command, args []string) {
|
|||||||
inspector := createInspector()
|
inspector := createInspector()
|
||||||
for i, qname := range args {
|
for i, qname := range args {
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
fmt.Printf("\n%s\n", separator)
|
fmt.Printf("\n%s\n\n", separator)
|
||||||
}
|
}
|
||||||
fmt.Println()
|
|
||||||
info, err := inspector.GetQueueInfo(qname)
|
info, err := inspector.GetQueueInfo(qname)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("error: %v\n", err)
|
fmt.Printf("error: %v\n", err)
|
||||||
@ -179,9 +178,9 @@ func queueHistory(cmd *cobra.Command, args []string) {
|
|||||||
inspector := createInspector()
|
inspector := createInspector()
|
||||||
for i, qname := range args {
|
for i, qname := range args {
|
||||||
if i > 0 {
|
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)
|
stats, err := inspector.History(qname, days)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("error: %v\n", err)
|
fmt.Printf("error: %v\n", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user