-
Notifications
You must be signed in to change notification settings - Fork 4
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
Feature request: Max duration including execution time? #9
Comments
You should be able to use the callback facility for that: (I can't test this at the moment, so please forgive me for any broken code) (def *timeout* 3000)
(again/with-retries
{::again/callback #(when (< *timeout* (::again/slept %) ::again/fail)
::again/strategy ...}
(my-operation …)) |
I guess my wordings weren't clear about what I wanted to do but
So this |
Yes, you're right: My assumptions were that:
So therefore I didn't feel the need to keep track of the execution time. But I appreciate that this might not be the case if your attempts are failing eg because of network timeouts. You could use the (def *timeout* 3000)
(again/with-retries
{::again/callback #(let [execution-time (- (System/currentTimeMillis)
(::again/user-context %))]
(when (> execution-time *timeout*) ::again/fail))
::again/user-context (System/currentTimeMillis)
::again/strategy …}
(my-operation …)) I'll think about adding an For other readers: |
Thanks! To me, an easier to use api might be that just having an option to set the |
Haha, yes a Using the callback argument will allow people to do whatever they want with the I think I should probably add both at the expense of making the API more complicated. Anyhow, thanks for the feedback - it's always nice to hear about specific use-cases of the library! |
Kiitos (I recognize your finnish name) for quick responses and considering my use cases :) |
One of the manipulator says
But I think there are use cases to limit the duration by the sum of delay times and the actual time that took for execution. (e.g. if we want to retry calling an external service only until the caller of our service times out, etc).
The text was updated successfully, but these errors were encountered: