Skip to content

Commit

Permalink
chore: fix ameba
Browse files Browse the repository at this point in the history
  • Loading branch information
stakach committed Apr 7, 2020
1 parent 9d00ebb commit 50168a3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 4 additions & 4 deletions spec/retry_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe SimpleRetry do
SimpleRetry.try_to(raise_on: DivisionByZeroError) do |count|
raise "some issue" if count < 5
final_count = count
result = count // 0
count // 0
count
end
end
Expand All @@ -27,7 +27,7 @@ describe SimpleRetry do
expect_raises(Exception) do
SimpleRetry.try_to(retry_on: DivisionByZeroError) do |count|
final_count = count
result = count // 0 if count < 3
count // 0 if count < 3
raise "different error"
count
end
Expand All @@ -52,7 +52,7 @@ describe SimpleRetry do
final_count = SimpleRetry.try_to(
base_interval: 10.milliseconds,
max_interval: 50.milliseconds
) do |count, last_error, sleep_time|
) do |count, _, sleep_time|
times << sleep_time
raise "some issue" if count < 7
count
Expand All @@ -75,7 +75,7 @@ describe SimpleRetry do
randomise: 9.milliseconds,
base_interval: 10.milliseconds,
max_interval: 50.milliseconds
) do |count, last_error, sleep_time|
) do |count, _, sleep_time|
times << sleep_time
raise "some issue" if count < 7
count
Expand Down
2 changes: 2 additions & 0 deletions src/simple_retry.cr
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ module SimpleRetry
end
end

# ameba:disable Metrics/CyclomaticComplexity
def try_to(
max_attempts : Int? = nil,
retry_on : Exception.class | Nil = nil,
Expand Down Expand Up @@ -73,6 +74,7 @@ module SimpleRetry
end
end

# ameba:disable Metrics/CyclomaticComplexity
def try_to(
randomise : Time::Span,
max_attempts : Int? = nil,
Expand Down

0 comments on commit 50168a3

Please sign in to comment.