[refs #893] small refactoring

This commit is contained in:
Alexander Machehin 2013-02-13 15:32:28 +06:00
parent 9dfdfc5a04
commit 1a3db04817
2 changed files with 4 additions and 4 deletions

View File

@ -141,11 +141,10 @@ class Platforms::RepositoriesController < Platforms::BaseController
end end
def regenerate_metadata def regenerate_metadata
if Resque.redis.lrange(AbfWorker::BuildListsPublishTaskManager::REGENERATE_METADATA, 0, -1).include? @repository.id.to_s if AbfWorker::BuildListsPublishTaskManager.repository_regenerate_metadata @repository.id
flash[:error] = t('flash.repository.regenerate_already_in_queue')
else
AbfWorker::BuildListsPublishTaskManager.repository_regenerate_metadata @repository.id
flash[:notice] = t('flash.repository.regenerate_in_queue') flash[:notice] = t('flash.repository.regenerate_in_queue')
else
flash[:error] = t('flash.repository.regenerate_already_in_queue')
end end
redirect_to platform_repository_path(@platform, @repository) redirect_to platform_repository_path(@platform, @repository)
end end

View File

@ -53,6 +53,7 @@ module AbfWorker
end end
def repository_regenerate_metadata(repository_id) def repository_regenerate_metadata(repository_id)
return false if Resque.redis.lrange(REGENERATE_METADATA, 0, -1).include? repository_id.to_s
redis.lpush REGENERATE_METADATA, repository_id redis.lpush REGENERATE_METADATA, repository_id
end end