2
0
mirror of https://github.com/hibiken/asynq.git synced 2026-06-21 14:40:33 +08:00

Compare commits

...

3 Commits

Author SHA1 Message Date
Mohammed Sohail
d135f1439b docs: add inline clarification on DISABLE_MEMORY_USAGE_PROFILING usage 2026-06-12 12:03:33 +03:00
Mohamed Sohail
c5474c501b Merge pull request #1127 from grnhse/disable-mem-usage
Try disabling memory usage profiling
2026-06-12 11:58:35 +03:00
David Yoon
7429091c93 Try disabling memory usage profiling 2026-04-29 12:56:38 -04:00

View File

@@ -7,6 +7,7 @@ package rdb
import (
"context"
"fmt"
"os"
"strings"
"time"
@@ -137,6 +138,8 @@ table.insert(res, aggregating_count)
return res`)
// CurrentStats returns a current state of the queues.
// if DISABLE_MEMORY_USAGE_PROFILING is set to "true" or any non empty value, memory usage profiling will be disabled
// which is otherwise always performed..
func (r *RDB) CurrentStats(qname string) (*Stats, error) {
var op errors.Op = "rdb.CurrentStats"
exists, err := r.queueExists(qname)
@@ -228,11 +231,15 @@ func (r *RDB) CurrentStats(qname string) (*Stats, error) {
}
}
stats.Size = size
memusg, err := r.memoryUsage(qname)
if err != nil {
return nil, errors.E(op, errors.CanonicalCode(err), err)
disableMemUsageProfiling := os.Getenv("DISABLE_MEMORY_USAGE_PROFILING")
if disableMemUsageProfiling == "false" || disableMemUsageProfiling == "" {
memusg, err := r.memoryUsage(qname)
if err != nil {
return nil, errors.E(op, errors.CanonicalCode(err), err)
}
stats.MemoryUsage = memusg
}
stats.MemoryUsage = memusg
return stats, nil
}