From 3a060e548080e0d792369f6b0d88e1a031c3cec1 Mon Sep 17 00:00:00 2001 From: Stephen Margheim Date: Mon, 16 Dec 2024 19:19:49 +0100 Subject: [PATCH] Remove unnecessary proc to simplify code and improve performance a bit --- lib/acidic_job/workflow.rb | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/acidic_job/workflow.rb b/lib/acidic_job/workflow.rb index 57eae12..3cd258d 100644 --- a/lib/acidic_job/workflow.rb +++ b/lib/acidic_job/workflow.rb @@ -129,12 +129,11 @@ def take_step(step_definition) return next_step if @execution.entries.exists?(step: curr_step, action: :succeeded) - step_method = performable_step_for(step_definition) rescued_error = nil begin @execution.record!(step: curr_step, action: :started, timestamp: Time.now) result = AcidicJob.instrument(:perform_step, **step_definition) do - step_method.call + perform_step_for(step_definition) end case result when REPEAT_STEP @@ -167,7 +166,7 @@ def take_step(step_definition) end end - def performable_step_for(step_definition) + def perform_step_for(step_definition) step_name = step_definition.fetch("does") step_method = method(step_name) @@ -175,9 +174,7 @@ def performable_step_for(step_definition) wrapper = step_definition["transactional"] ? @execution.method(:with_lock) : NO_OP_WRAPPER - proc do - catch(:repeat) { wrapper.call { step_method.call } } - end + catch(:repeat) { wrapper.call { step_method.call } } rescue NameError raise UndefinedMethodError.new(step_name) end