Class: SpreeCmCommissioner::MaintenanceTask
- Includes:
- StoreMetadata
- Defined in:
- app/models/spree_cm_commissioner/maintenance_task.rb
Direct Known Subclasses
SpreeCmCommissioner::MaintenanceTasks::Event, SpreeCmCommissioner::MaintenanceTasks::VotingSession
Constant Summary collapse
- MAX_ATTEMPTS =
5
Instance Method Summary collapse
- #async_execute ⇒ Object
-
#execute ⇒ Object
Execute the maintenance task with error handling and attempt tracking.
-
#maintain ⇒ Object
Override in subclasses with specific maintenance logic.
Instance Method Details
#async_execute ⇒ Object
21 22 23 |
# File 'app/models/spree_cm_commissioner/maintenance_task.rb', line 21 def async_execute SpreeCmCommissioner::MaintenanceTasks::ProcessJob.perform_later(task_id: id) end |
#execute ⇒ Object
Execute the maintenance task with error handling and attempt tracking
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/models/spree_cm_commissioner/maintenance_task.rb', line 26 def execute update(attempt_count: attempt_count + 1) maintain update!(completed_at: Time.current) # Don't re-raise - continue processing other tasks rescue StandardError => e update(last_error: e.) log_failure(e) end |
#maintain ⇒ Object
Override in subclasses with specific maintenance logic
40 41 42 |
# File 'app/models/spree_cm_commissioner/maintenance_task.rb', line 40 def maintain raise NotImplementedError, "#{self.class} must implement #maintain" end |