mirror of
https://github.com/hibiken/asynq.git
synced 2024-11-10 11:31:58 +08:00
Update asynqmon
This commit is contained in:
parent
f3b9745228
commit
5626670007
3
.gitignore
vendored
3
.gitignore
vendored
@ -13,3 +13,6 @@
|
||||
|
||||
# Ignore examples for now
|
||||
/examples
|
||||
|
||||
# Ignore command binary
|
||||
/cmd/asynqmon/asynqmon
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
func printStats(s *rdb.Stats) {
|
||||
|
Loading…
Reference in New Issue
Block a user