Class: RubyReactor::Step::AsyncReactorStep

Inherits:
Object
  • Object
show all
Includes:
RubyReactor::Step
Defined in:
lib/ruby_reactor/step/async_reactor_step.rb

Overview

The dispatching half of async_reactor: everything that happens in the PARENT's process. The child then runs as an ordinary independently dispatched reactor execution — no new enqueue primitive, no new storage primitive, and no entry in the parent's compensation graph.

Dispatch reuses the full pre-enqueue sequence of a top-level async run rather than a raw perform_async, because Reactor#run does three load-bearing things a naive Context.new + enqueue would silently skip: validate the child's inputs (the worker's resume path never validates, so skipping here starts a child on garbage), assign the ordered-lock nonce at ENQUEUE time (so ordering matches caller order), and persist before enqueueing (F2).

Class Method Summary collapse

Methods included from RubyReactor::Step

included

Class Method Details

.run(arguments, context) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/ruby_reactor/step/async_reactor_step.rb', line 21

def run(arguments, context)
  child_class = arguments[:async_reactor_class]
  child_inputs = build_child_inputs(arguments[:argument_mappings] || {}, context)

  # A dispatch-time failure fails the DISPATCHING step, i.e. normal saga
  # handling in the parent. That is deliberately outside the
  # no-auto-compensation rule, which governs the child's own execution.
  validation = validate_child_inputs(child_class, child_inputs)
  return validation if validation

  deadlock = detect_lock_deadlock(child_class, child_inputs, context)
  return deadlock if deadlock

  return run_inline(child_class, child_inputs, context) if run_inline?(context)

  dispatch(child_class, child_inputs, context)
end