Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retry on *any* exception, forever #66

Open
krisleech opened this issue Sep 19, 2024 · 0 comments
Open

Retry on *any* exception, forever #66

krisleech opened this issue Sep 19, 2024 · 0 comments

Comments

@krisleech
Copy link

We are consuming messages from Kafka using Broadway.

Since Broadway will always ack the message we need to handle retry ourselves.

If there is any error we want to retry indefinitely.

This is the code we have:

retry_while with: exponential_backoff(1000) |> cap(10_000) do
  try do
    raise "BOOM"
  rescue
    exception ->
      report(exception, __STACKTRACE__)
      {:cont, nil}
   else
      _ -> {:halt, nil}
  end
end

I assume if I don't use Stream.take then it will retry forever?

Any additional thoughts on this approach?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant