safwank/ElixirRetry

Arithmetic error when taking many values from a stream

Closed this issue · 2 comments

Code that reproduces the issue on retry 0.10:

iex(18)> Retry.DelayStreams.exp_backoff(100) |> Retry.DelayStreams.cap(30_000) |> Enum.take(10_000)
** (ArithmeticError) bad argument in arithmetic expression
    (retry) lib/retry/delay_streams.ex:22: anonymous fn/2 in Retry.DelayStreams.exp_backoff/1
    (elixir) lib/stream.ex:1466: Stream.do_unfold/4
    (elixir) lib/stream.ex:1536: Enumerable.Stream.do_each/4
    (elixir) lib/enum.ex:2423: Enum.take/2

I usually won't be taking 10_000 elements from the stream but it seems possible that with other stream compositions this could happen sooner.

@axelson Thanks for reporting this.

Fixed in v0.11.1.