Update BuildListsPublishTaskManager and PublishObserver

This commit is contained in:
Vokhmin Alexey V 2013-03-20 01:11:16 +04:00
parent cdc0d2a9f9
commit 1a44b634f9
3 changed files with 6 additions and 4 deletions

View File

@ -32,7 +32,7 @@ module AbfWorker
def sort_results_and_save(results, item = subject) def sort_results_and_save(results, item = subject)
item.results = results.sort_by{ |r| r['file_name'] } item.results = results.sort_by{ |r| r['file_name'] }
item.save! item.save(false)
end end
end end

View File

@ -237,8 +237,9 @@ module AbfWorker
build_lists = build_lists.where('build_lists.id NOT IN (?)', locked_ids) unless locked_ids.empty? build_lists = build_lists.where('build_lists.id NOT IN (?)', locked_ids) unless locked_ids.empty?
build_lists = build_lists.limit(50) build_lists = build_lists.limit(50)
project_ids = build_lists.map(&:project_id).uniq
projects_for_cleanup = @redis.lrange(PROJECTS_FOR_CLEANUP, 0, -1). projects_for_cleanup = @redis.lrange(PROJECTS_FOR_CLEANUP, 0, -1).
select{ |k| k =~ /#{save_to_repository_id}\-#{build_for_platform_id}$/ } select{ |k| k =~ /#{save_to_repository_id}\-#{build_for_platform_id}$/ && k !~ /^(#{project_ids.join('|')})\-/ }
old_packages = {:sources => [], :binaries => {:x86_64 => [], :i586 => []}} old_packages = {:sources => [], :binaries => {:x86_64 => [], :i586 => []}}

View File

@ -36,9 +36,10 @@ module AbfWorker
update_results build_list update_results build_list
case status case status
when COMPLETED when COMPLETED
build_list.published # `update_column` - when build_list has been removed from repository
build_list.published || build_list.update_column(:status, BuildList::BUILD_PUBLISHED)
when FAILED, CANCELED when FAILED, CANCELED
build_list.fail_publish build_list.fail_publish || build_list.update_column(:status, BuildList::FAILED_PUBLISH)
end end
AbfWorker::BuildListsPublishTaskManager.unlock_build_list build_list AbfWorker::BuildListsPublishTaskManager.unlock_build_list build_list
end end