mirror of
https://github.com/hibiken/asynq.git
synced 2025-08-19 15:08:55 +08:00
Rename Enqueued to Pending
This commit is contained in:
@@ -145,9 +145,9 @@ func printQueueStats(s *asynq.QueueStats) {
|
||||
fmt.Printf("Paused: %t\n\n", s.Paused)
|
||||
fmt.Println("Task Breakdown:")
|
||||
printTable(
|
||||
[]string{"InProgress", "Enqueued", "Scheduled", "Retry", "Dead"},
|
||||
[]string{"InProgress", "Pending", "Scheduled", "Retry", "Dead"},
|
||||
func(w io.Writer, tmpl string) {
|
||||
fmt.Fprintf(w, tmpl, s.InProgress, s.Enqueued, s.Scheduled, s.Retry, s.Dead)
|
||||
fmt.Fprintf(w, tmpl, s.InProgress, s.Pending, s.Scheduled, s.Retry, s.Dead)
|
||||
},
|
||||
)
|
||||
fmt.Println()
|
||||
|
@@ -52,7 +52,7 @@ func init() {
|
||||
|
||||
type AggregateStats struct {
|
||||
InProgress int
|
||||
Enqueued int
|
||||
Pending int
|
||||
Scheduled int
|
||||
Retry int
|
||||
Dead int
|
||||
@@ -79,7 +79,7 @@ func stats(cmd *cobra.Command, args []string) {
|
||||
os.Exit(1)
|
||||
}
|
||||
aggStats.InProgress += s.InProgress
|
||||
aggStats.Enqueued += s.Enqueued
|
||||
aggStats.Pending += s.Pending
|
||||
aggStats.Scheduled += s.Scheduled
|
||||
aggStats.Retry += s.Retry
|
||||
aggStats.Dead += s.Dead
|
||||
@@ -113,9 +113,9 @@ func stats(cmd *cobra.Command, args []string) {
|
||||
func printStatsByState(s *AggregateStats) {
|
||||
format := strings.Repeat("%v\t", 5) + "\n"
|
||||
tw := new(tabwriter.Writer).Init(os.Stdout, 0, 8, 2, ' ', 0)
|
||||
fmt.Fprintf(tw, format, "InProgress", "Enqueued", "Scheduled", "Retry", "Dead")
|
||||
fmt.Fprintf(tw, format, "InProgress", "Pending", "Scheduled", "Retry", "Dead")
|
||||
fmt.Fprintf(tw, format, "----------", "--------", "---------", "-----", "----")
|
||||
fmt.Fprintf(tw, format, s.InProgress, s.Enqueued, s.Scheduled, s.Retry, s.Dead)
|
||||
fmt.Fprintf(tw, format, s.InProgress, s.Pending, s.Scheduled, s.Retry, s.Dead)
|
||||
tw.Flush()
|
||||
}
|
||||
|
||||
|
@@ -75,7 +75,7 @@ var taskListCmd = &cobra.Command{
|
||||
|
||||
The value for the state flag should be one of:
|
||||
- in-progress
|
||||
- enqueued
|
||||
- pending
|
||||
- scheduled
|
||||
- retry
|
||||
- dead
|
||||
@@ -85,11 +85,11 @@ By default, the command fetches the first 30 tasks.
|
||||
Use --page and --size flags to specify the page number and size.
|
||||
|
||||
Example:
|
||||
To list enqueued tasks from "default" queue, run
|
||||
asynq task ls --queue=default --state=enqueued
|
||||
To list pending tasks from "default" queue, run
|
||||
asynq task ls --queue=default --state=pending
|
||||
|
||||
To list the tasks from the second page, run
|
||||
asynq task ls --queue=default --state=enqueued --page=1`,
|
||||
asynq task ls --queue=default --state=pending --page=1`,
|
||||
Run: taskList,
|
||||
}
|
||||
|
||||
@@ -167,8 +167,8 @@ func taskList(cmd *cobra.Command, args []string) {
|
||||
switch state {
|
||||
case "in-progress":
|
||||
listInProgressTasks(qname, pageNum, pageSize)
|
||||
case "enqueued":
|
||||
listEnqueuedTasks(qname, pageNum, pageSize)
|
||||
case "pending":
|
||||
listPendingTasks(qname, pageNum, pageSize)
|
||||
case "scheduled":
|
||||
listScheduledTasks(qname, pageNum, pageSize)
|
||||
case "retry":
|
||||
@@ -202,15 +202,15 @@ func listInProgressTasks(qname string, pageNum, pageSize int) {
|
||||
)
|
||||
}
|
||||
|
||||
func listEnqueuedTasks(qname string, pageNum, pageSize int) {
|
||||
func listPendingTasks(qname string, pageNum, pageSize int) {
|
||||
i := createInspector()
|
||||
tasks, err := i.ListEnqueuedTasks(qname, asynq.PageSize(pageSize), asynq.Page(pageNum))
|
||||
tasks, err := i.ListPendingTasks(qname, asynq.PageSize(pageSize), asynq.Page(pageNum))
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
if len(tasks) == 0 {
|
||||
fmt.Printf("No enqueued tasks in %q queue\n", qname)
|
||||
fmt.Printf("No pending tasks in %q queue\n", qname)
|
||||
return
|
||||
}
|
||||
printTable(
|
||||
|
Reference in New Issue
Block a user