From 562667000712c073f395c4ae5b6f02d0c4d4ce31 Mon Sep 17 00:00:00 2001 From: Ken Hibino Date: Thu, 5 Dec 2019 17:14:35 -0800 Subject: [PATCH] Update asynqmon --- .gitignore | 5 ++++- cmd/asynqmon/main.go | 17 ++++++----------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index 20ec1f7..bd9b26c 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,7 @@ *.out # Ignore examples for now -/examples \ No newline at end of file +/examples + +# Ignore command binary +/cmd/asynqmon/asynqmon \ No newline at end of file diff --git a/cmd/asynqmon/main.go b/cmd/asynqmon/main.go index 6b50c24..b881c21 100644 --- a/cmd/asynqmon/main.go +++ b/cmd/asynqmon/main.go @@ -1,19 +1,17 @@ package main import ( - "flag" "fmt" "log" "os" "strings" "text/tabwriter" - "time" "github.com/go-redis/redis/v7" "github.com/hibiken/asynq/internal/rdb" ) -var pollInterval = flag.Duration("interval", 3*time.Second, "polling interval") +// Example usage: watch -n5 asynqmon func main() { c := redis.NewClient(&redis.Options{ @@ -22,15 +20,12 @@ func main() { }) r := rdb.NewRDB(c) - for { - stats, err := r.CurrentStats() - if err != nil { - log.Fatal(err) - } - printStats(stats) - fmt.Println() - time.Sleep(*pollInterval) + stats, err := r.CurrentStats() + if err != nil { + log.Fatal(err) } + printStats(stats) + fmt.Println() } func printStats(s *rdb.Stats) {