mirror of
https://github.com/hibiken/asynq.git
synced 2025-08-24 14:48:40 +08:00
fix: CurrentState without processed/failed data
This commit is contained in:
@@ -84,7 +84,13 @@ func printStats(s *rdb.Stats) {
|
||||
tw := new(tabwriter.Writer).Init(os.Stdout, 0, 8, 2, ' ', 0)
|
||||
fmt.Fprintf(tw, format, "Processed", "Failed", "Error Rate")
|
||||
fmt.Fprintf(tw, format, "---------", "------", "----------")
|
||||
fmt.Fprintf(tw, format, s.Processed, s.Failed, fmt.Sprintf("%.2f%%", float64(s.Failed)/float64(s.Processed)*100))
|
||||
var errrate string
|
||||
if s.Processed == 0 {
|
||||
errrate = "N/A"
|
||||
} else {
|
||||
errrate = fmt.Sprintf("%.2f%%", float64(s.Failed)/float64(s.Processed)*100)
|
||||
}
|
||||
fmt.Fprintf(tw, format, s.Processed, s.Failed, errrate)
|
||||
tw.Flush()
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user