2016-05-28 19:21:02 +01:00
|
|
|
class PublishTaskManagerJob < BaseActiveRecordJob
|
|
|
|
include Sidekiq::Worker
|
|
|
|
sidekiq_options :queue => :middle
|
2014-06-19 20:35:53 +01:00
|
|
|
|
2016-05-28 19:21:02 +01:00
|
|
|
def perform_with_ar_connection
|
2014-06-19 20:35:53 +01:00
|
|
|
regenerate_metadata_for_software_center
|
|
|
|
resign_repositories
|
|
|
|
regenerate_metadata
|
2014-06-20 20:23:31 +01:00
|
|
|
AbfWorkerService::Rpm.publish!
|
2014-06-19 20:35:53 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
protected
|
|
|
|
|
|
|
|
def regenerate_metadata_for_software_center
|
|
|
|
Platform.main.waiting_for_regeneration.each do |platform|
|
|
|
|
AbfWorkerService::PlatformMetadata.new(platform).regenerate!
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def resign_repositories
|
|
|
|
statuses = RepositoryStatus.platform_ready.
|
|
|
|
for_resign.includes(repository: :platform).readonly(false)
|
|
|
|
|
|
|
|
statuses.each do |repository_status|
|
|
|
|
AbfWorkerService::Repository.new(repository_status.repository).resign!(repository_status)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def regenerate_metadata
|
|
|
|
statuses = RepositoryStatus.platform_ready.
|
|
|
|
for_regeneration.includes(repository: :platform).readonly(false)
|
|
|
|
|
|
|
|
statuses.each do |repository_status|
|
|
|
|
AbfWorkerService::RepositoryMetadata.new(repository_status).regenerate!
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
end
|