diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-17 21:09:16 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-17 21:09:16 +0000 |
commit | 154b9bae142ba15fec753f44327654595094b879 (patch) | |
tree | 027f8ae024961778d5b00c77a72fe302f985d4f3 /app/workers | |
parent | 2c156e3c7bbade01c36eee18327f1ced6eebea79 (diff) | |
download | gitlab-ce-154b9bae142ba15fec753f44327654595094b879.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/workers')
-rw-r--r-- | app/workers/all_queues.yml | 4 | ||||
-rw-r--r-- | app/workers/chat_notification_worker.rb | 8 | ||||
-rw-r--r-- | app/workers/repository_fork_worker.rb | 26 |
3 files changed, 17 insertions, 21 deletions
diff --git a/app/workers/all_queues.yml b/app/workers/all_queues.yml index 9b9b1417e22..28fab10d931 100644 --- a/app/workers/all_queues.yml +++ b/app/workers/all_queues.yml @@ -866,8 +866,8 @@ :idempotent: - :name: chat_notification :feature_category: :chatops - :has_external_dependencies: - :urgency: :high + :has_external_dependencies: true + :urgency: :low :resource_boundary: :unknown :weight: 2 :idempotent: diff --git a/app/workers/chat_notification_worker.rb b/app/workers/chat_notification_worker.rb index 058ac024f8a..5fab437f49f 100644 --- a/app/workers/chat_notification_worker.rb +++ b/app/workers/chat_notification_worker.rb @@ -7,13 +7,9 @@ class ChatNotificationWorker # rubocop:disable Scalability/IdempotentWorker sidekiq_options retry: false feature_category :chatops - urgency :high + urgency :low # Can't be high as it has external dependencies weight 2 - - # TODO: break this into multiple jobs - # as the `responder` uses external dependencies - # See https://gitlab.com/gitlab-com/gl-infra/scalability/issues/34 - # worker_has_external_dependencies! + worker_has_external_dependencies! RESCHEDULE_INTERVAL = 2.seconds RESCHEDULE_TIMEOUT = 5.minutes diff --git a/app/workers/repository_fork_worker.rb b/app/workers/repository_fork_worker.rb index b202c568d93..395fce0696c 100644 --- a/app/workers/repository_fork_worker.rb +++ b/app/workers/repository_fork_worker.rb @@ -2,7 +2,6 @@ class RepositoryForkWorker # rubocop:disable Scalability/IdempotentWorker include ApplicationWorker - include Gitlab::ShellAdapter include ProjectStartImport include ProjectImportOptions @@ -27,18 +26,8 @@ class RepositoryForkWorker # rubocop:disable Scalability/IdempotentWorker Gitlab::Metrics.add_event(:fork_repository) - result = gitlab_shell.fork_repository(source_project, target_project) - - if result - link_lfs_objects(source_project, target_project) - else - raise_fork_failure( - source_project, - target_project, - 'Failed to create fork repository' - ) - end - + gitaly_fork!(source_project, target_project) + link_lfs_objects(source_project, target_project) target_project.after_import end @@ -49,6 +38,17 @@ class RepositoryForkWorker # rubocop:disable Scalability/IdempotentWorker false end + def gitaly_fork!(source_project, target_project) + source_repo = source_project.repository.raw + target_repo = target_project.repository.raw + + ::Gitlab::GitalyClient::RepositoryService.new(target_repo).fork_repository(source_repo) + rescue GRPC::BadStatus => e + Gitlab::ErrorTracking.track_exception(e, source_project_id: source_project.id, target_project_id: target_project.id) + + raise_fork_failure(source_project, target_project, 'Failed to create fork repository') + end + def link_lfs_objects(source_project, target_project) Projects::LfsPointers::LfsLinkService .new(target_project) |