I'd like to implement a thread that will send an email, then send a response via websocket to the client when the send completes.
(defn my-wait-loop [] (async/go-loop [status (async/<! @mailer-status)] (if status (do (println "Ready to send " status) (doseq [chan @connections] (println "Channel" chan) (send! chan (pr-str "Done" status))) (recur (async/<! @mailer-status))) (println "Go away")))) (defn test-mailer [] ;;(my-wait-loop) (reset! mailer-status (async/thread (try (mailer/send-speaker-confirmation-notification 1 "http://localhost") (catch Exception e (println (.getMessage e)))) "Success"))) I would like to have the go-loop inside my-wait-loop run at all times, waiting for mailer-status to have a value. But I believe that can never happen, since the go-loop is waiting on an empty channel, and the reset! with the mailer will replace the channel with a new one after the emails are sent. Is there a batter way to do this, without needing to call my-wait-loop before the email thread is dispatched? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.