Last active
March 22, 2019 13:59
-
-
Save joncol/fecacf04d1c7c428ad5596aa7fb36710 to your computer and use it in GitHub Desktop.
Timed Clojure thingy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def ^:private credentials-status-atom (atom nil)) | |
(defn- credentials-status [] | |
(when-not @credentials-status-atom | |
(reset! credentials-status-atom | |
{:status "awaiting_mobile_bankid_authentication"}) | |
(future | |
(Thread/sleep 3000) | |
(reset! credentials-status-atom {:status "updating"})) | |
(future | |
(Thread/sleep 6000) | |
(reset! credentials-status-atom {:status "updated"})) | |
;; Reset the atom to nil after 2 seconds of `updated` to give test clients | |
;; some time to react to the status change. | |
(future | |
(Thread/sleep 8000) | |
(reset! credentials-status-atom nil))) | |
@credentials-status-atom) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment