Skip to content

Commit

Permalink
Move RetryPolicy into Executor.Retries
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewDryga committed Nov 29, 2017
1 parent a501a6c commit 5143fe1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/sage/executor.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/sage/retry_policy.ex → lib/sage/executor/retries.ex
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 5143fe1

Please sign in to comment.