Skip to content

Commit 9eb6ff3

Browse files
committed
Switch to untracked api where appropriate
1 parent 10705bb commit 9eb6ff3

File tree

8 files changed

+17
-8
lines changed

8 files changed

+17
-8
lines changed

examples/chunked_output_benchmark.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def main_loop
1212
if output[:current] < input[:limit]
1313
consumed = yield
1414
output[:current] += consumed
15-
plan_event(nil)
15+
plan_event(nil, untracked: true)
1616
suspend
1717
end
1818
end

examples/orchestrate.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/usr/bin/env ruby
22
# frozen_string_literal: true
33

4+
require_relative 'example_helper'
5+
46
example_description = <<DESC
57
Orchestrate Example
68
===================
@@ -21,8 +23,6 @@
2123
2224
DESC
2325

24-
require_relative 'example_helper'
25-
2626
module Orchestrate
2727

2828
class CreateInfrastructure < Dynflow::Action

examples/orchestrate_evented.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def run(event = nil)
7575
# do nothing
7676
end),
7777
(on nil do
78-
suspend { |suspended_action| world.clock.ping suspended_action, rand(1), Finished }
78+
suspend { |suspended_action| world.clock.ping suspended_action, rand(1), Finished, untracked: true }
7979
end))
8080
end
8181

lib/dynflow/action/polling.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def resume_external_action
9191
end
9292

9393
def suspend_and_ping
94-
plan_event(Poll, poll_interval)
94+
plan_event(Poll, poll_interval, untracked: true)
9595
suspend
9696
end
9797

lib/dynflow/action/timeouts.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def process_timeout
88
end
99

1010
def schedule_timeout(seconds, optional: false)
11-
plan_event(Timeout, seconds, optional: optional)
11+
plan_event(Timeout, seconds, optional: optional, untracked: true)
1212
end
1313
end
1414
end

lib/dynflow/action/with_bulk_sub_plans.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def run_progress
7070
def spawn_plans
7171
super
7272
ensure
73-
plan_event(PlanNextBatch)
73+
plan_event(PlanNextBatch, untracked: true)
7474
end
7575

7676
def cancel!(force = false)

lib/dynflow/action/with_polling_sub_plans.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,9 @@ def recalculate_counts
7070
:failed_count => failed - output.fetch(:resumed_count, 0),
7171
:success_count => success)
7272
end
73+
74+
def can_fire_and_forget_sub_plans?
75+
true
76+
end
7377
end
7478
end

lib/dynflow/action/with_sub_plans.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ def trigger(action_class, *args)
8181
if uses_concurrency_control
8282
trigger_with_concurrency_control(action_class, *args)
8383
else
84-
world.trigger { world.plan_with_options(action_class: action_class, args: args, caller_action: self) }
84+
method = can_fire_and_forget_sub_plans? ? :trigger_untracked : :trigger
85+
world.public_send(:trigger) { world.plan_with_options(action_class: action_class, args: args, caller_action: self) }
8586
end
8687
end
8788

@@ -234,5 +235,9 @@ def check_for_errors!
234235
def uses_concurrency_control
235236
@uses_concurrency_control = input.key? :concurrency_control
236237
end
238+
239+
def can_fire_and_forget_sub_plans?
240+
false
241+
end
237242
end
238243
end

0 commit comments

Comments
 (0)