Welcome to mirror list, hosted at ThFree Co, Russian Federation.

project_update_repository_storage_worker.rb « workers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7c0b1ae07fac0d08bfb47a71737d198e472221e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# frozen_string_literal: true

class ProjectUpdateRepositoryStorageWorker
  include ApplicationWorker

  idempotent!
  feature_category :gitaly
  urgency :throttled

  def perform(project_id, new_repository_storage_key, repository_storage_move_id = nil)
    repository_storage_move =
      if repository_storage_move_id
        ProjectRepositoryStorageMove.find(repository_storage_move_id)
      else
        # maintain compatibility with workers queued before release
        project = Project.find(project_id)
        project.repository_storage_moves.create!(
          source_storage_name: project.repository_storage,
          destination_storage_name: new_repository_storage_key
        )
      end

    ::Projects::UpdateRepositoryStorageService.new(repository_storage_move).execute
  end
end