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

Update asynqmon

This commit is contained in:
Ken Hibino 2019-12-05 17:14:35 -08:00
parent f3b9745228
commit 5626670007
2 changed files with 10 additions and 12 deletions

5
.gitignore vendored
View File

@ -12,4 +12,7 @@
*.out
# Ignore examples for now
/examples
/examples
# Ignore command binary
/cmd/asynqmon/asynqmon

View File

@ -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) {