Commit eae68880 authored by Patricio Cano's avatar Patricio Cano Committed by Gabriel Mazetto

Don't schedule backfill on create. It needs to be manually triggered now, and...

Don't schedule backfill on create. It needs to be manually triggered now, and RepoUpdateWorker gets its own queue.
parent 30bcd4b4
......@@ -38,6 +38,17 @@ class Admin::GeoNodesController < Admin::ApplicationController
redirect_to admin_geo_nodes_path
end
def backfill_repositories
@node = GeoNode.find(params[:id])
if @node.primary?
redirect_to admin_geo_nodes_path, notice: 'This is the primary node. Please run this action with a secondary node.'
else
@node.backfill_repositories
redirect_to admin_geo_nodes_path, notice: 'Backfill scheduled successfully.'
end
end
private
def geo_node_params
......
......@@ -17,7 +17,6 @@ class GeoNode < ActiveRecord::Base
validates :relative_url_root, length: { minimum: 0, allow_nil: false }
after_initialize :build_dependents
after_create :backfill_repositories
after_save :refresh_bulk_notify_worker_status
after_destroy :refresh_bulk_notify_worker_status
before_validation :update_dependents_attributes
......
......@@ -9,7 +9,7 @@ module Geo
def execute
return if geo_node_id.nil?
Project.all.select(&:valid_repo?).each do |project|
Project.all.select(&:valid_repo?).find_each(batch_size: 100) do |project|
GeoBackfillWorker.perform_async(geo_node_id, project.id)
end
end
......
......@@ -56,4 +56,10 @@
= link_to repair_admin_geo_node_path(node), method: :post, title: 'OAuth application is missing', class: 'btn btn-default, btn-sm' do
= icon('exclamation-triangle fw')
Repair authentication
= link_to 'Remove', admin_geo_node_path(node), data: { confirm: 'Are you sure?' }, method: :delete, class: 'btn btn-remove btn-sm'
- unless node.primary?
= link_to backfill_repositories_admin_geo_node_path(node), method: :post, class: 'btn btn-primary btn-sm' do
= icon 'map-signs'
Backfill all repositories
= link_to admin_geo_node_path(node), data: { confirm: 'Are you sure?' }, method: :delete, class: 'btn btn-remove btn-sm' do
= icon 'trash'
Remove
class GeoRepositoryUpdateWorker
include Sidekiq::Worker
include Gitlab::ShellAdapter
include GeoQueue
include DedicatedSidekiqQueue
attr_accessor :project
......
......@@ -105,6 +105,7 @@ namespace :admin do
resources :geo_nodes, only: [:index, :create, :destroy] do
member do
post :repair
post :backfill_repositories
end
end
## EE-specific
......
......@@ -52,3 +52,4 @@
- [geo, 1]
- [project_update_repository_storage, 1]
- [admin_emails, 1]
- [geo_repository_update, 1]
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment