diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-09 15:09:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-09 15:09:24 +0300 |
commit | a9ced7da447785c57477b3d8dbccc73a78cface1 (patch) | |
tree | 5179d27ab9d801748ee4ed1c64c985974e799812 /app/workers | |
parent | ad0265eead72a624ce7a020847db4f0f0c877e57 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/workers')
7 files changed, 9 insertions, 13 deletions
diff --git a/app/workers/concerns/gitlab/jira_import/import_worker.rb b/app/workers/concerns/gitlab/jira_import/import_worker.rb index 7cc650bfc29..169d3797b88 100644 --- a/app/workers/concerns/gitlab/jira_import/import_worker.rb +++ b/app/workers/concerns/gitlab/jira_import/import_worker.rb @@ -28,7 +28,7 @@ module Gitlab return false unless project return false if Feature.disabled?(:jira_issue_import, project) - project.import_state.started? + project.latest_jira_import&.started? end end end diff --git a/app/workers/gitlab/jira_import/advance_stage_worker.rb b/app/workers/gitlab/jira_import/advance_stage_worker.rb index c83a57bcd83..c3a64669c60 100644 --- a/app/workers/gitlab/jira_import/advance_stage_worker.rb +++ b/app/workers/gitlab/jira_import/advance_stage_worker.rb @@ -17,7 +17,7 @@ module Gitlab }.freeze def find_import_state(project_id) - ProjectImportState.jid_by(project_id: project_id, status: :started) + JiraImportState.jid_by(project_id: project_id, status: :started) end private diff --git a/app/workers/gitlab/jira_import/stage/finish_import_worker.rb b/app/workers/gitlab/jira_import/stage/finish_import_worker.rb index f053037e78a..1d57b77ac7e 100644 --- a/app/workers/gitlab/jira_import/stage/finish_import_worker.rb +++ b/app/workers/gitlab/jira_import/stage/finish_import_worker.rb @@ -9,11 +9,8 @@ module Gitlab private def import(project) - project.after_import - ensure JiraImport.cache_cleanup(project.id) - project.import_data.becomes(JiraImportData).finish_import! - project.import_data.save! + project.latest_jira_import&.finish! end end end diff --git a/app/workers/gitlab/jira_import/stage/import_attachments_worker.rb b/app/workers/gitlab/jira_import/stage/import_attachments_worker.rb index 3b209a279b5..905ef3efa67 100644 --- a/app/workers/gitlab/jira_import/stage/import_attachments_worker.rb +++ b/app/workers/gitlab/jira_import/stage/import_attachments_worker.rb @@ -13,7 +13,7 @@ module Gitlab # new job waiter will have zero jobs_remaining by default, so it will just pass on to next stage fake_waiter = JobWaiter.new - project.import_state.refresh_jid_expiration + project.latest_jira_import.refresh_jid_expiration Gitlab::JiraImport::AdvanceStageWorker.perform_async(project.id, { fake_waiter.key => fake_waiter.jobs_remaining }, :notes) end end diff --git a/app/workers/gitlab/jira_import/stage/import_issues_worker.rb b/app/workers/gitlab/jira_import/stage/import_issues_worker.rb index 7e257afc4d9..7a5eb6c1e3a 100644 --- a/app/workers/gitlab/jira_import/stage/import_issues_worker.rb +++ b/app/workers/gitlab/jira_import/stage/import_issues_worker.rb @@ -11,7 +11,7 @@ module Gitlab def import(project) jobs_waiter = Gitlab::JiraImport::IssuesImporter.new(project).execute - project.import_state.refresh_jid_expiration + project.latest_jira_import.refresh_jid_expiration Gitlab::JiraImport::AdvanceStageWorker.perform_async( project.id, diff --git a/app/workers/gitlab/jira_import/stage/import_notes_worker.rb b/app/workers/gitlab/jira_import/stage/import_notes_worker.rb index 9eef0d31a8c..b34e64b203b 100644 --- a/app/workers/gitlab/jira_import/stage/import_notes_worker.rb +++ b/app/workers/gitlab/jira_import/stage/import_notes_worker.rb @@ -12,7 +12,7 @@ module Gitlab # fake notes import workers for now # new job waiter will have zero jobs_remaining by default, so it will just pass on to next stage jobs_waiter = JobWaiter.new - project.import_state.refresh_jid_expiration + project.latest_jira_import.refresh_jid_expiration Gitlab::JiraImport::AdvanceStageWorker.perform_async(project.id, { jobs_waiter.key => jobs_waiter.jobs_remaining }, :finish) end diff --git a/app/workers/gitlab/jira_import/stage/start_import_worker.rb b/app/workers/gitlab/jira_import/stage/start_import_worker.rb index 80f0221c53d..1561ad90cc1 100644 --- a/app/workers/gitlab/jira_import/stage/start_import_worker.rb +++ b/app/workers/gitlab/jira_import/stage/start_import_worker.rb @@ -16,7 +16,7 @@ module Gitlab return unless start_import - Gitlab::Import::SetAsyncJid.set_jid(project.import_state) + Gitlab::Import::SetAsyncJid.set_jid(project.latest_jira_import) Gitlab::JiraImport::Stage::ImportLabelsWorker.perform_async(project.id) end @@ -26,14 +26,13 @@ module Gitlab def start_import return false unless project return false if Feature.disabled?(:jira_issue_import, project) - return false unless project.jira_force_import? - return true if start(project.import_state) + return true if start(project.latest_jira_import) Gitlab::Import::Logger.info( { project_id: project.id, project_path: project.full_path, - state: project&.import_status, + state: project&.jira_import_status, message: 'inconsistent state while importing' } ) |