mirror of
https://github.com/hibiken/asynq.git
synced 2026-04-12 09:35:51 +08:00
Compare commits
6 Commits
preview-v0
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f81c78e68d | ||
|
|
2fd155e31d | ||
|
|
d704b68a42 | ||
|
|
ff887e1f89 | ||
|
|
5de9b1faf0 | ||
|
|
8261a03f0d |
@@ -264,8 +264,10 @@ for i=1,2 do
|
|||||||
if (table.getn(ids) > 0) then
|
if (table.getn(ids) > 0) then
|
||||||
for _, id in ipairs(ids) do
|
for _, id in ipairs(ids) do
|
||||||
local bytes = redis.call("MEMORY", "USAGE", ARGV[1] .. id)
|
local bytes = redis.call("MEMORY", "USAGE", ARGV[1] .. id)
|
||||||
|
if bytes then
|
||||||
sample_total = sample_total + bytes
|
sample_total = sample_total + bytes
|
||||||
end
|
end
|
||||||
|
end
|
||||||
local n = redis.call("LLEN", KEYS[i])
|
local n = redis.call("LLEN", KEYS[i])
|
||||||
local avg = sample_total / table.getn(ids)
|
local avg = sample_total / table.getn(ids)
|
||||||
memusg = memusg + (avg * n)
|
memusg = memusg + (avg * n)
|
||||||
@@ -281,8 +283,10 @@ for i=3,6 do
|
|||||||
if (table.getn(ids) > 0) then
|
if (table.getn(ids) > 0) then
|
||||||
for _, id in ipairs(ids) do
|
for _, id in ipairs(ids) do
|
||||||
local bytes = redis.call("MEMORY", "USAGE", ARGV[1] .. id)
|
local bytes = redis.call("MEMORY", "USAGE", ARGV[1] .. id)
|
||||||
|
if bytes then
|
||||||
sample_total = sample_total + bytes
|
sample_total = sample_total + bytes
|
||||||
end
|
end
|
||||||
|
end
|
||||||
local n = redis.call("ZCARD", KEYS[i])
|
local n = redis.call("ZCARD", KEYS[i])
|
||||||
local avg = sample_total / table.getn(ids)
|
local avg = sample_total / table.getn(ids)
|
||||||
memusg = memusg + (avg * n)
|
memusg = memusg + (avg * n)
|
||||||
@@ -304,14 +308,18 @@ if table.getn(groups) > 0 then
|
|||||||
local ids = redis.call("ZRANGE", group_key, 0, sample_size - 1)
|
local ids = redis.call("ZRANGE", group_key, 0, sample_size - 1)
|
||||||
for _, id in ipairs(ids) do
|
for _, id in ipairs(ids) do
|
||||||
local bytes = redis.call("MEMORY", "USAGE", ARGV[1] .. id)
|
local bytes = redis.call("MEMORY", "USAGE", ARGV[1] .. id)
|
||||||
|
if bytes then
|
||||||
agg_task_sample_total = agg_task_sample_total + bytes
|
agg_task_sample_total = agg_task_sample_total + bytes
|
||||||
agg_task_sample_size = agg_task_sample_size + 1
|
agg_task_sample_size = agg_task_sample_size + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
if agg_task_sample_size > 0 then
|
||||||
local avg = agg_task_sample_total / agg_task_sample_size
|
local avg = agg_task_sample_total / agg_task_sample_size
|
||||||
memusg = memusg + (avg * agg_task_count)
|
memusg = memusg + (avg * agg_task_count)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
return memusg
|
return memusg
|
||||||
`)
|
`)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user