diff --git a/lib/abf_worker/base_observer.rb b/lib/abf_worker/base_observer.rb index 45151da79..d7d1ec01a 100644 --- a/lib/abf_worker/base_observer.rb +++ b/lib/abf_worker/base_observer.rb @@ -32,7 +32,7 @@ module AbfWorker def sort_results_and_save(results, item = subject) item.results = results.sort_by{ |r| r['file_name'] } - item.save! + item.save(false) end end diff --git a/lib/abf_worker/build_lists_publish_task_manager.rb b/lib/abf_worker/build_lists_publish_task_manager.rb index dc731f2dc..bba427d49 100644 --- a/lib/abf_worker/build_lists_publish_task_manager.rb +++ b/lib/abf_worker/build_lists_publish_task_manager.rb @@ -228,6 +228,17 @@ module AbfWorker end def create_rpm_build_task(save_to_repository_id, build_for_platform_id) + projects_for_cleanup = @redis.lrange(PROJECTS_FOR_CLEANUP, 0, -1). + select{ |k| k =~ /#{save_to_repository_id}\-#{build_for_platform_id}$/ } + + # We should not to publish new builds into repository + # if project of builds has been removed from repository. + BuildList.where( + :project_id => projects_for_cleanup.map{ |k| k.split('-')[0] }.uniq, + :save_to_repository_id => repository.id, + :status => BuildList::BUILD_PUBLISH + ).update_all(:status => BuildList::FAILED_PUBLISH) + build_lists = BuildList. where(:new_core => true, :status => BuildList::BUILD_PUBLISH). where(:save_to_repository_id => save_to_repository_id). @@ -237,9 +248,6 @@ module AbfWorker build_lists = build_lists.where('build_lists.id NOT IN (?)', locked_ids) unless locked_ids.empty? build_lists = build_lists.limit(50) - projects_for_cleanup = @redis.lrange(PROJECTS_FOR_CLEANUP, 0, -1). - select{ |k| k =~ /#{save_to_repository_id}\-#{build_for_platform_id}$/ } - old_packages = {:sources => [], :binaries => {:x86_64 => [], :i586 => []}} projects_for_cleanup.each do |key| diff --git a/lib/abf_worker/publish_observer.rb b/lib/abf_worker/publish_observer.rb index a3958510f..a6166535a 100644 --- a/lib/abf_worker/publish_observer.rb +++ b/lib/abf_worker/publish_observer.rb @@ -36,9 +36,10 @@ module AbfWorker update_results build_list case status when COMPLETED - build_list.published + # 'update_column' - when project of build_list has been removed from repository + build_list.published || build_list.update_column(:status, BuildList::BUILD_PUBLISHED) when FAILED, CANCELED - build_list.fail_publish + build_list.fail_publish || build_list.update_column(:status, BuildList::FAILED_PUBLISH) end AbfWorker::BuildListsPublishTaskManager.unlock_build_list build_list end