class CronoTrigger::ExecutionTracker
Public Class Methods
new(schedulable)
click to toggle source
# File lib/crono_trigger/execution_tracker.rb, line 3 def initialize(schedulable) @schedulable = schedulable end
track(schedulable, &pr)
click to toggle source
# File lib/crono_trigger/execution_tracker.rb, line 7 def self.track(schedulable, &pr) new(schedulable).track(&pr) end
Public Instance Methods
track(&pr)
click to toggle source
# File lib/crono_trigger/execution_tracker.rb, line 11 def track(&pr) if @schedulable.track_execution begin execution = @schedulable.crono_trigger_executions.create_with_timestamp! result = pr.call case result when :ok execution.complete! when :retry execution.retrying! when :abort execution.aborted! else execution.complete! end rescue => e execution.error!(e) raise end else pr.call end end