could anyone recommend me a library for retrying (with exponential backoff) using deferred?
Zach addressed this sort of in this reddit post: https://www.reddit.com/r/Clojure/comments/48lf1a/managing_websocket_stability_issues_with_aleph/ Fairly easy to extend his example with exponential backoff:
(defn reconnect-loop!
[conn-generator]
(let [loop! (fn this [timeout]
(d/chain
(conn-generator)
(fn [conn]
(if conn
(s/on-closed conn this)
(do @(d/future (Thread/sleep (t/seconds timeout)))
(this (* timeout 2)))))))]
(loop! 1)))
awesome! just what i was looking for!
thanks a lot!
No worries 🙂