2020-03-02 21:08:01 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-07-02 00:09:51 +00:00
|
|
|
class ProjectUpdateRepositoryStorageWorker
|
2020-03-02 21:08:01 +00:00
|
|
|
include ApplicationWorker
|
|
|
|
|
2020-07-02 00:09:51 +00:00
|
|
|
idempotent!
|
2020-03-14 00:09:30 +00:00
|
|
|
feature_category :gitaly
|
2020-07-02 12:09:02 +00:00
|
|
|
urgency :throttled
|
2020-03-02 21:08:01 +00:00
|
|
|
|
2020-05-11 00:09:29 +00:00
|
|
|
def perform(project_id, new_repository_storage_key, repository_storage_move_id = nil)
|
2020-05-06 06:09:36 +00:00
|
|
|
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-03-02 21:08:01 +00:00
|
|
|
|
2020-05-06 06:09:36 +00:00
|
|
|
::Projects::UpdateRepositoryStorageService.new(repository_storage_move).execute
|
2020-03-02 21:08:01 +00:00
|
|
|
end
|
|
|
|
end
|