diff options
Diffstat (limited to 'app/models/bulk_imports/tracker.rb')
-rw-r--r-- | app/models/bulk_imports/tracker.rb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/app/models/bulk_imports/tracker.rb b/app/models/bulk_imports/tracker.rb index 9de3239ee0f..cfe33c013ba 100644 --- a/app/models/bulk_imports/tracker.rb +++ b/app/models/bulk_imports/tracker.rb @@ -29,7 +29,7 @@ class BulkImports::Tracker < ApplicationRecord def self.stage_running?(entity_id, stage) where(stage: stage, bulk_import_entity_id: entity_id) - .with_status(:created, :started) + .with_status(:created, :enqueued, :started) .exists? end @@ -45,15 +45,24 @@ class BulkImports::Tracker < ApplicationRecord state :created, value: 0 state :started, value: 1 state :finished, value: 2 + state :enqueued, value: 3 state :failed, value: -1 state :skipped, value: -2 event :start do - transition created: :started + transition enqueued: :started # To avoid errors when re-starting a pipeline in case of network errors transition started: :started end + event :retry do + transition started: :enqueued + end + + event :enqueue do + transition created: :enqueued + end + event :finish do transition started: :finished transition failed: :failed |