Closed jvtrigueros closed 3 years ago
@jvtrigueros thank you for reporting. deflistener
was removed with failsafe 2.0 iirc. I have updated to doc and will create a release to fix it on cljdoc.
{:policy policy
:on-retry (fn [_ _] (println "(Re)Attempting to fetch user: " id)}
This case wasn't considered before but I agree it should be supported. A fix will be added soon.
Released in 0.10.1
I'm reading the cljdoc on predefined listeners, the documentation states:
So problem number one here
diehard/deflistener
no longer exists, I see that it was introduced in version 0.3.0, but I don't know when it went away. That's fine, so we can rewrite the above code as follows:The problem here is that once the
policy
key is provided, all the other keys are ignored and they wont affect the providedRetryPolicy
object.My goal was to create a base
RetryPolicy
object once, and provide the listener functions at the call site so that I can use the inputs, something like this:This is a contrived example but essentially split the policy from the listeners that need local information.
TL;DR: The documentation doesn't match what the code is doing, what is the correct the code or the docs?
What I'll end up doing is define my policy as a Clojure map and
assoc
the listener keys at the call site, e.g.: