Class: CronoTrigger::Models::Execution
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- CronoTrigger::Models::Execution
- Defined in:
- lib/crono_trigger/models/execution.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.create_with_timestamp! ⇒ Object
28 29 30 |
# File 'lib/crono_trigger/models/execution.rb', line 28 def self. create!(executed_at: Time.current, status: :executing, worker_id: CronoTrigger.config.worker_id) end |
Instance Method Details
#complete! ⇒ Object
32 33 34 |
# File 'lib/crono_trigger/models/execution.rb', line 32 def complete! update!(status: :completed, completed_at: Time.current) end |
#error!(exception) ⇒ Object
36 37 38 |
# File 'lib/crono_trigger/models/execution.rb', line 36 def error!(exception) update!(status: :failed, completed_at: Time.current, error_name: exception.class.to_s, error_reason: exception.) end |
#retry! ⇒ Object
40 41 42 43 44 |
# File 'lib/crono_trigger/models/execution.rb', line 40 def retry! return false if schedule.locking? schedule.retry! end |