app/lib/actions/recurring_action.rb in foreman-tasks-0.14.6 vs app/lib/actions/recurring_action.rb in foreman-tasks-0.15.0
- old
+ new
@@ -1,5 +1,7 @@
+require 'securerandom'
+
module Actions
module RecurringAction
# When included sets the base action to use the RecurringLogic middleware and configures
# #trigger_repeat to be called when appropriate to trigger the next repeat.
def self.included(base)
@@ -8,14 +10,18 @@
end
# Hook to be called when a repetition needs to be triggered. This either happens when the plan goes into planned state
# or when it fails.
def trigger_repeat(execution_plan)
+ request_id = ::Logging.mdc['request']
+ ::Logging.mdc['request'] = SecureRandom.uuid
if execution_plan.delay_record && recurring_logic_task_group
args = execution_plan.delay_record.args
logic = recurring_logic_task_group.recurring_logic
logic.trigger_repeat_after(task.start_at, self.class, *args)
end
+ ensure
+ ::Logging.mdc['request'] = request_id
end
private
def recurring_logic_task_group