From 29f1c1c9990c84f0f22e31c3fbd032176ad36b90 Mon Sep 17 00:00:00 2001 From: Adam Ruzicka Date: Tue, 6 Sep 2022 10:21:17 +0200 Subject: [PATCH] Switch to untracked api where appropriate --- examples/chunked_output_benchmark.rb | 2 +- examples/orchestrate.rb | 3 ++- examples/orchestrate_evented.rb | 2 +- lib/dynflow/action/polling.rb | 2 +- lib/dynflow/action/timeouts.rb | 2 +- lib/dynflow/action/with_bulk_sub_plans.rb | 2 +- lib/dynflow/action/with_polling_sub_plans.rb | 4 ++++ lib/dynflow/action/with_sub_plans.rb | 7 ++++++- 8 files changed, 17 insertions(+), 7 deletions(-) diff --git a/examples/chunked_output_benchmark.rb b/examples/chunked_output_benchmark.rb index 3aa3a3659..237b1c91b 100644 --- a/examples/chunked_output_benchmark.rb +++ b/examples/chunked_output_benchmark.rb @@ -12,7 +12,7 @@ def main_loop if output[:current] < input[:limit] consumed = yield output[:current] += consumed - plan_event(nil) + plan_event(nil, untracked: true) suspend end end diff --git a/examples/orchestrate.rb b/examples/orchestrate.rb index fdb3a42c6..bdf1cd120 100755 --- a/examples/orchestrate.rb +++ b/examples/orchestrate.rb @@ -1,6 +1,8 @@ #!/usr/bin/env ruby # frozen_string_literal: true +require_relative 'example_helper' + example_description = < failed - output.fetch(:resumed_count, 0), :success_count => success) end + + def can_fire_and_forget_sub_plans? + true + end end end diff --git a/lib/dynflow/action/with_sub_plans.rb b/lib/dynflow/action/with_sub_plans.rb index 3be37e69a..5e3d31451 100644 --- a/lib/dynflow/action/with_sub_plans.rb +++ b/lib/dynflow/action/with_sub_plans.rb @@ -81,7 +81,8 @@ def trigger(action_class, *args) if uses_concurrency_control trigger_with_concurrency_control(action_class, *args) else - world.trigger { world.plan_with_options(action_class: action_class, args: args, caller_action: self) } + method = can_fire_and_forget_sub_plans? ? :trigger_untracked : :trigger + world.public_send(:trigger) { world.plan_with_options(action_class: action_class, args: args, caller_action: self) } end end @@ -234,5 +235,9 @@ def check_for_errors! def uses_concurrency_control @uses_concurrency_control = input.key? :concurrency_control end + + def can_fire_and_forget_sub_plans? + false + end end end