Permalink
Browse files

Cleanup, refactoring, updated transaction

  • Loading branch information...
1 parent fe20a97 commit 4838d5e0b873e5b99060611e6461da238447f6e7 @avokhmin avokhmin committed Feb 24, 2014
Showing with 6 additions and 4 deletions.
  1. +1 −0 app/jobs/clean_build_lists_queues_job.rb
  2. +5 −4 lib/abf_worker/model_helper.rb
@@ -8,6 +8,7 @@ def self.perform
queue = "queue:#{key}"
if redis.llen(queue) == 0
redis.multi do
+ redis.watch queue
redis.del queue
redis.srem 'queues', key
end
@@ -53,12 +53,11 @@ def cancel_job
end
def destroy_from_resque_queue
- result = Resque::Job.destroy(
+ Resque::Job.destroy(
worker_queue_with_priority,
worker_queue_class,
abf_worker_args
)
- result
end
def worker_queue_with_priority(prefix = true)
@@ -88,8 +87,10 @@ def update_build_sets
return unless is_a?(BuildList)
key = mass_build_id ? MASS_BUILDS_SET : USER_BUILDS_SET
- Resque.redis.sadd key, mass_build_id || user_id
- Resque.redis.sadd 'queues', worker_queue_with_priority
+ Resque.redis.pipelined do
+ Resque.redis.sadd key, mass_build_id || user_id
+ Resque.redis.sadd 'queues', worker_queue_with_priority
+ end
end

0 comments on commit 4838d5e

Please sign in to comment.