Class: Smith::Workflow::Parallel::NestedExecution

Inherits:
Object
  • Object
show all
Extended by:
Dry::Initializer
Defined in:
lib/smith/workflow/parallel/nested_execution.rb

Instance Method Summary collapse

Constructor Details

#initializeNestedExecution

Returns a new instance of NestedExecution.



15
16
17
18
# File 'lib/smith/workflow/parallel/nested_execution.rb', line 15

def initialize(...)
  super
  @depth = context.next_nesting_depth!
end

Instance Method Details

#callObject



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/smith/workflow/parallel/nested_execution.rb', line 20

def call
  Thread.handle_interrupt(Object => :never) do
    prepare
    Thread.handle_interrupt(Object => :immediate) { execute }
  rescue Exception => e # rubocop:disable Lint/RescueException
    context.signal.cancel!(e)
    raise
  ensure
    drain_futures
    release_workers
  end
end