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

Callback if max elapsed time has been reached #76

Open
jcobian opened this issue Mar 6, 2019 · 0 comments
Open

Callback if max elapsed time has been reached #76

jcobian opened this issue Mar 6, 2019 · 0 comments

Comments

@jcobian
Copy link
Contributor

jcobian commented Mar 6, 2019

Currently if retriable anticipates that the max_elapsed_time will be reached, it just raises the error right then.

This is fine however as a user, I'd like to know if this has occurred and if this is the reason the code is no longer being retried (as opposed to if it was just because we reached the number of tries)

So this issue proposes the following interface:

do_this_when_max_elapsed_time_reached = Proc.new do |exception, try, elapsed_time|
  # ex: log here that the max elapsed time has been reached
end
Retriable.retriable(on_max_elapsed_time_reached: do_this_when_max_elapsed_time_reached) do
  # code here...
end

This mainly comes up b/c I have an idea for how long the code will run, but it can sometimes run for longer and I'd like to log these instances

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