2
0
mirror of https://github.com/hibiken/asynq.git synced 2026-04-06 06:45:52 +08:00

Compare commits

...

2 Commits

Author SHA1 Message Date
Ken Hibino
aaa3f1d4fd v0.16.1 2021-03-20 06:27:03 -07:00
disc
4722ca2d3d Replaced blocking KEYS XXX:* command to non-blocking SCAN XXX:*
More details: https://redis.io/commands/KEYS
2021-03-20 06:24:08 -07:00
3 changed files with 18 additions and 4 deletions

View File

@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [0.16.1] - 2021-03-20
### Fixed
- Replace `KEYS` command with `SCAN` as recommended by [redis doc](https://redis.io/commands/KEYS).
## [0.16.0] - 2021-03-10
### Added

View File

@@ -19,7 +19,7 @@ import (
)
// Version of asynq library and CLI.
const Version = "0.16.0"
const Version = "0.16.1"
// DefaultQueueName is the queue name used if none are specified by user.
const DefaultQueueName = "default"

View File

@@ -172,9 +172,17 @@ func (r *RDB) CurrentStats(qname string) (*Stats, error) {
}
func (r *RDB) memoryUsage(qname string) (int64, error) {
keys, err := r.client.Keys(fmt.Sprintf("asynq:{%s}*", qname)).Result()
if err != nil {
return 0, err
var cursor uint64
var keys []string
for {
data, cursor, err := r.client.Scan(cursor, fmt.Sprintf("asynq:{%s}*", qname), 100).Result()
if err != nil {
return 0, err
}
keys = append(keys, data...)
if cursor == 0 {
break
}
}
var usg int64
for _, k := range keys {