diff --git a/app/controllers/platforms/repositories_controller.rb b/app/controllers/platforms/repositories_controller.rb index ea6c7293b..9b92e1360 100644 --- a/app/controllers/platforms/repositories_controller.rb +++ b/app/controllers/platforms/repositories_controller.rb @@ -141,11 +141,10 @@ class Platforms::RepositoriesController < Platforms::BaseController end def regenerate_metadata - if Resque.redis.lrange(AbfWorker::BuildListsPublishTaskManager::REGENERATE_METADATA, 0, -1).include? @repository.id.to_s - flash[:error] = t('flash.repository.regenerate_already_in_queue') - else - AbfWorker::BuildListsPublishTaskManager.repository_regenerate_metadata @repository.id + if AbfWorker::BuildListsPublishTaskManager.repository_regenerate_metadata @repository.id flash[:notice] = t('flash.repository.regenerate_in_queue') + else + flash[:error] = t('flash.repository.regenerate_already_in_queue') end redirect_to platform_repository_path(@platform, @repository) end diff --git a/lib/abf_worker/build_lists_publish_task_manager.rb b/lib/abf_worker/build_lists_publish_task_manager.rb index 99750f1ba..a49177389 100644 --- a/lib/abf_worker/build_lists_publish_task_manager.rb +++ b/lib/abf_worker/build_lists_publish_task_manager.rb @@ -53,6 +53,7 @@ module AbfWorker end 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 end