mirror of
https://github.com/hibiken/asynq.git
synced 2024-11-10 11:31:58 +08:00
Replaced blocking KEYS XXX:*
command to non-blocking SCAN XXX:*
More details: https://redis.io/commands/KEYS
This commit is contained in:
parent
6a9d9fd717
commit
4722ca2d3d
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user