Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/project_import_state.rb')
-rw-r--r--app/models/project_import_state.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/app/models/project_import_state.rb b/app/models/project_import_state.rb
index b1c1a5b6697..7711c6d604a 100644
--- a/app/models/project_import_state.rb
+++ b/app/models/project_import_state.rb
@@ -31,6 +31,10 @@ class ProjectImportState < ApplicationRecord
transition started: :finished
end
+ event :cancel do
+ transition [:none, :scheduled, :started] => :canceled
+ end
+
event :fail_op do
transition [:scheduled, :started] => :failed
end
@@ -39,6 +43,7 @@ class ProjectImportState < ApplicationRecord
state :started
state :finished
state :failed
+ state :canceled
after_transition [:none, :finished, :failed] => :scheduled do |state, _|
state.run_after_commit do
@@ -51,7 +56,7 @@ class ProjectImportState < ApplicationRecord
end
end
- after_transition any => :finished do |state, _|
+ after_transition any => [:canceled, :finished] do |state, _|
if state.jid.present?
Gitlab::SidekiqStatus.unset(state.jid)
@@ -59,7 +64,7 @@ class ProjectImportState < ApplicationRecord
end
end
- after_transition any => :failed do |state, _|
+ after_transition any => [:canceled, :failed] do |state, _|
state.project.remove_import_data
end