lib/acidic_job/step.rb in acidic_job-1.0.0.pre17 vs lib/acidic_job/step.rb in acidic_job-1.0.0.pre18
- old
+ new
@@ -52,12 +52,12 @@
# {"does" => :enqueue_step, "then" => :next_step, "awaits" => [WorkerWithEnqueueStep::FirstWorker]}
current_step = step["does"]
next_step = step["then"]
# to support iteration within steps
iterable_key = step["for_each"]
- iterated_key = "processed_#{iterable_key}"
- iterables = @run.attr_accessors.fetch(iterable_key, [])
- iterateds = @run.attr_accessors.fetch(iterated_key, [])
+ iterated_key = "processed_#{current_step}_#{iterable_key}"
+ iterables = @run.attr_accessors.fetch(iterable_key, []) || []
+ iterateds = @run.attr_accessors.fetch(iterated_key, []) || []
next_item = iterables.reject { |item| iterateds.include? item }.first
# jobs can have no-op steps, especially so that they can use only the async/await mechanism for that step
callable = if @job.respond_to?(current_step, _include_private = true)
@job.method(current_step)