Class: SagaForge::CompensationJob
- Inherits:
-
ActiveJob::Base
- Object
- ActiveJob::Base
- SagaForge::CompensationJob
- Defined in:
- lib/saga_forge/compensation_job.rb
Constant Summary collapse
- CONCURRENCY_KEY =
See ExecutionJob::CONCURRENCY_KEY for why this is a constant.
->(state_id) { state = State.find_by(id: state_id) state ? "SagaLock:#{state.saga_class}:#{state.correlation_id}" : "SagaLock:none" }
Instance Method Summary collapse
Instance Method Details
#perform(state_id) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/saga_forge/compensation_job.rb', line 15 def perform(state_id) state = State.find_by(id: state_id) return unless state return unless state.current_state == State::COMPENSATING.to_s outcome, wait = CompensationRunner.new(state).call retry_job(wait: wait) if outcome == :retry end |