Callback if max elapsed time has been reached
jcobian opened this issue · 0 comments
jcobian commented
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