diff options
Diffstat (limited to 'app/models/jira_import_state.rb')
-rw-r--r-- | app/models/jira_import_state.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/models/jira_import_state.rb b/app/models/jira_import_state.rb index 713feec013f..ec1b8f03d36 100644 --- a/app/models/jira_import_state.rb +++ b/app/models/jira_import_state.rb @@ -22,6 +22,8 @@ class JiraImportState < ApplicationRecord message: _('Cannot have multiple Jira imports running at the same time') } + alias_method :scheduled_by, :user + state_machine :status, initial: :initial do event :schedule do transition initial: :scheduled @@ -46,6 +48,11 @@ class JiraImportState < ApplicationRecord end end + before_transition any => :finished do |state, _| + InternalId.flush_records!(project: state.project) + state.project.update_project_counter_caches + end + after_transition any => :finished do |state, _| if state.jid.present? Gitlab::SidekiqStatus.unset(state.jid) @@ -67,4 +74,8 @@ class JiraImportState < ApplicationRecord def in_progress? scheduled? || started? end + + def non_initial? + !initial? + end end |