From 157f9a451a428f66666ba85d8b880df78aff6cc4 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Fri, 22 Nov 2019 00:06:08 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- app/models/project_import_state.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'app/models/project_import_state.rb') diff --git a/app/models/project_import_state.rb b/app/models/project_import_state.rb index bff00816e15..b79e3554926 100644 --- a/app/models/project_import_state.rb +++ b/app/models/project_import_state.rb @@ -42,6 +42,14 @@ class ProjectImportState < ApplicationRecord end end + after_transition any => :finished do |state, _| + if state.jid.present? + Gitlab::SidekiqStatus.unset(state.jid) + + state.update_column(:jid, nil) + end + end + after_transition started: :finished do |state, _| project = state.project @@ -81,14 +89,6 @@ class ProjectImportState < ApplicationRecord status == 'started' && project.import? end - def remove_jid - return unless jid - - Gitlab::SidekiqStatus.unset(jid) - - update_column(:jid, nil) - end - # Refreshes the expiration time of the associated import job ID. # # This method can be used by asynchronous importers to refresh the status, -- cgit v1.2.3