#848: small refactoring

This commit is contained in:
Vokhmin Alexey V 2013-01-24 15:58:42 +04:00
parent 262483f30b
commit e1b79a3c1f
1 changed files with 3 additions and 3 deletions

View File

@ -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))