diehard icon indicating copy to clipboard operation
diehard copied to clipboard

question on future(...) contruct use

Open dalegaspi opened this issue 6 years ago • 1 comments

is there an equivalent construct here that allows something like this:

(require '[diehard.core :as dh])
(dh/with-retry {:retry-on TimeoutException
                :max-retries 3}
  (fetch-data-from-the-moon-future))

where fetch-data-from-the-moon-future is a future(...) and of course the function will return another future?

...i mean it doesn't have to be a future, it can be a thread or anything else as long as async construct equivalents are available.

dalegaspi avatar Oct 16 '19 19:10 dalegaspi

At the moment it is not possible. Can you put the synchronise block into a future, like

(defn fetch-data-from-the-moon-future []
  (future
    (dh/with-retry {:retry-on TimeoutException
                           :max-retries 3}
      (fetch-data-from-the-moon))))

sunng87 avatar Oct 19 '19 16:10 sunng87