2020-04-08 14:13:33 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class ProjectUpdateRepositoryStorageWorker # rubocop:disable Scalability/IdempotentWorker
|
|
|
|
include ApplicationWorker
|
|
|
|
|
|
|
|
feature_category :gitaly
|
|
|
|
|
2020-05-24 23:13:21 +05:30
|
|
|
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
|
2020-04-08 14:13:33 +05:30
|
|
|
|
2020-05-24 23:13:21 +05:30
|
|
|
::Projects::UpdateRepositoryStorageService.new(repository_storage_move).execute
|
2020-04-08 14:13:33 +05:30
|
|
|
end
|
|
|
|
end
|