diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-08 21:08:27 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-08 21:08:27 +0300 |
commit | 99c01aa6867b91b8d2279eb8d32794ea90d5dcdc (patch) | |
tree | ae36b06dd962230381080d9e2a31385cea5f8609 /app/workers | |
parent | 5693fb6ba7d21ba7b79775543a3f195eb989664b (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/workers')
-rw-r--r-- | app/workers/all_queues.yml | 10 | ||||
-rw-r--r-- | app/workers/gitlab/import/stuck_project_import_jobs_worker.rb | 22 | ||||
-rw-r--r-- | app/workers/gitlab/phabricator_import/base_worker.rb | 2 |
3 files changed, 32 insertions, 2 deletions
diff --git a/app/workers/all_queues.yml b/app/workers/all_queues.yml index bcb3679a8c5..0699be0f4cb 100644 --- a/app/workers/all_queues.yml +++ b/app/workers/all_queues.yml @@ -147,6 +147,14 @@ :weight: 1 :idempotent: :tags: [] +- :name: cronjob:import_stuck_project_import_jobs + :feature_category: :importers + :has_external_dependencies: + :urgency: :low + :resource_boundary: :cpu + :weight: 1 + :idempotent: + :tags: [] - :name: cronjob:issue_due_scheduler :feature_category: :issue_tracking :has_external_dependencies: @@ -813,7 +821,7 @@ :tags: [] - :name: pipeline_background:ci_build_report_result :feature_category: :continuous_integration - :has_external_dependencies: + :has_external_dependencies: :urgency: :low :resource_boundary: :unknown :weight: 1 diff --git a/app/workers/gitlab/import/stuck_project_import_jobs_worker.rb b/app/workers/gitlab/import/stuck_project_import_jobs_worker.rb new file mode 100644 index 00000000000..01979b2029f --- /dev/null +++ b/app/workers/gitlab/import/stuck_project_import_jobs_worker.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true +module Gitlab + module Import + class StuckProjectImportJobsWorker # rubocop:disable Scalability/IdempotentWorker + include Gitlab::Import::StuckImportJob + + private + + def track_metrics(with_jid_count, without_jid_count) + Gitlab::Metrics.add_event( + :stuck_import_jobs, + projects_without_jid_count: without_jid_count, + projects_with_jid_count: with_jid_count + ) + end + + def enqueued_import_states + ProjectImportState.with_status([:scheduled, :started]) + end + end + end +end diff --git a/app/workers/gitlab/phabricator_import/base_worker.rb b/app/workers/gitlab/phabricator_import/base_worker.rb index 82ef9e825f9..2dc4855f854 100644 --- a/app/workers/gitlab/phabricator_import/base_worker.rb +++ b/app/workers/gitlab/phabricator_import/base_worker.rb @@ -13,7 +13,7 @@ # - It keeps track of the jobs so we know how many jobs are running for the # project # - It refreshes the import jid, so it doesn't get cleaned up by the -# `StuckImportJobsWorker` +# `Gitlab::Import::StuckProjectImportJobsWorker` # - It marks the import as failed if a job failed to many times # - It marks the import as finished when all remaining jobs are done module Gitlab |