#848: small refactoring
This commit is contained in:
parent
262483f30b
commit
e1b79a3c1f
|
@ -21,14 +21,14 @@ module AbfWorker
|
||||||
status = {}
|
status = {}
|
||||||
queues.each do |worker|
|
queues.each do |worker|
|
||||||
workers = Resque.workers.select{ |w| yield w, worker }
|
workers = Resque.workers.select{ |w| yield w, worker }
|
||||||
fill_status status, workers, worker
|
status[worker] = status_of_worker workers, worker
|
||||||
end
|
end
|
||||||
status
|
status
|
||||||
end
|
end
|
||||||
|
|
||||||
def fill_status(status, workers, worker)
|
def status_of_worker(workers, worker)
|
||||||
redis, key = Resque.redis, "queue:#{worker}_worker"
|
redis, key = Resque.redis, "queue:#{worker}_worker"
|
||||||
status[worker] = {
|
{
|
||||||
:count => workers.count,
|
:count => workers.count,
|
||||||
:build_tasks => workers.select{ |w| w.working? }.count,
|
:build_tasks => workers.select{ |w| w.working? }.count,
|
||||||
:tasks => (redis.llen("#{key}_default") + redis.llen(key))
|
:tasks => (redis.llen("#{key}_default") + redis.llen(key))
|
||||||
|
|
Loading…
Reference in New Issue