#756: merge master into branch

This commit is contained in:
Vokhmin Alexey V 2013-02-06 14:54:12 +04:00
commit e72bd2d4f1
1 changed files with 15 additions and 1 deletions

View File

@ -1,5 +1,6 @@
module AbfWorker
class RpmWorkerObserver < AbfWorker::BaseObserver
RESTARTED_BUILD_LISTS = 'abf-worker::rpm-worker-observer::restarted-build-lists'
TESTS_FAILED = 5
@queue = :rpm_worker_observer
@ -9,8 +10,9 @@ module AbfWorker
end
def perform
item = find_or_create_item
return if restart_task
item = find_or_create_item
fill_container_data if status != STARTED
case status
@ -43,6 +45,18 @@ module AbfWorker
})
end
def restart_task
redis = Resque.redis
if redis.lrem(RESTARTED_BUILD_LISTS, 0, subject.id) > 0 || status != FAILED || (options['results'] || []).size > 1
return false
else
redis.lpush RESTARTED_BUILD_LISTS, subject.id
subject.update_column(:status, BuildList::BUILD_PENDING)
subject.add_job_to_abf_worker_queue
return true
end
end
def fill_container_data
packages = options['packages'] || []
packages.each do |package|