Refactoring of abf_worker/model_helper
This commit is contained in:
parent
f7e6dcb88b
commit
127553498f
|
@ -86,27 +86,20 @@ module AbfWorker::ModelHelper
|
||||||
private
|
private
|
||||||
|
|
||||||
def cleanup_build_sets
|
def cleanup_build_sets
|
||||||
return unless is_a?(BuildList)
|
Resque.redis.multi do
|
||||||
|
if Resque.redis.llen("queue:#{worker_queue_with_priority}") == 0
|
||||||
if Resque.redis.llen("queue:#{worker_queue_with_priority}") == 0
|
key = mass_build_id ? MASS_BUILDS_SET : USER_BUILDS_SET
|
||||||
if mass_build_id
|
Resque.redis.srem key, mass_build_id || user_id
|
||||||
Resque.redis.srem MASS_BUILDS_SET, mass_build_id
|
Resque.redis.del "queue:#{worker_queue_with_priority}"
|
||||||
else
|
|
||||||
Resque.redis.srem USER_BUILDS_SET, user_id
|
|
||||||
end
|
end
|
||||||
Resque.redis.del "queue:#{worker_queue_with_priority}"
|
end if is_a?(BuildList)
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_build_sets
|
def update_build_sets
|
||||||
return unless is_a?(BuildList)
|
return unless is_a?(BuildList)
|
||||||
|
|
||||||
if mass_build_id
|
key = mass_build_id ? MASS_BUILDS_SET : USER_BUILDS_SET
|
||||||
Resque.redis.sadd MASS_BUILDS_SET, mass_build_id
|
Resque.redis.sadd key, mass_build_id || user_id
|
||||||
else
|
|
||||||
Resque.redis.sadd USER_BUILDS_SET, user_id
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue