diff --git a/lib/sage/executor.ex b/lib/sage/executor.ex index b9a7ecc..3bb4314 100644 --- a/lib/sage/executor.ex +++ b/lib/sage/executor.ex @@ -3,7 +3,7 @@ defmodule Sage.Executor do This module is responsible for Sage execution. """ require Logger - alias Sage.RetryPolicy + alias Sage.Executor.Retries # # Inline functions for performance optimization # @compile {:inline, encode_integer: 1, encode_float: 1} @@ -311,7 +311,7 @@ defmodule Sage.Executor do when not elem(state, 3) do {last_effect_or_error, effects_so_far, {count, _old_retry_opts}, false, [], on_compensation_error, tracers} = state - if RetryPolicy.retry_with_backoff?(count, retry_opts) do + if Retries.retry_with_backoff?(count, retry_opts) do state = {last_effect_or_error, effects_so_far, {count + 1, retry_opts}, false, [], on_compensation_error, tracers} {:retry_transaction, {name, operation}, state} else diff --git a/lib/sage/retry_policy.ex b/lib/sage/executor/retries.ex similarity index 98% rename from lib/sage/retry_policy.ex rename to lib/sage/executor/retries.ex index c09f21c..609d8fe 100644 --- a/lib/sage/retry_policy.ex +++ b/lib/sage/executor/retries.ex @@ -1,4 +1,4 @@ -defmodule Sage.RetryPolicy do +defmodule Sage.Executor.Retries do @moduledoc """ This module implements retry logic with exponential back-off for compensations that want to retry transaction. diff --git a/test/sage/retry_policy_test.exs b/test/sage/executor/retries_test.exs similarity index 97% rename from test/sage/retry_policy_test.exs rename to test/sage/executor/retries_test.exs index 83b5b32..1fa5de0 100644 --- a/test/sage/retry_policy_test.exs +++ b/test/sage/executor/retries_test.exs @@ -1,7 +1,7 @@ -defmodule Sage.RetryPolicyTest do +defmodule Sage.Executor.RetriesTest do use ExUnit.Case, async: true import ExUnit.CaptureLog - import Sage.RetryPolicy + import Sage.Executor.Retries describe "retry_with_backoff?/2" do test "limits retry count" do